Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to know how to share url and webpage title by doing the following step.

  1. Select URL in Safari
  2. Right click and choose Share via Email
  3. Automator will open the email program, put the title of a web page as a subject, and put the URL in the message body.
share|improve this question
require 'cgi'

url =
curl = `curl -s -L #{url}`
title = CGI.unescapeHTML(curl.scan(/<title>(.*?)<\/title>/m)[0][0].strip)
mail = "mailto:?subject=#{CGI.escapeHTML(title)}&body=#{CGI.escapeHTML(url)}"
system("open", mail)
  1. Open Automator and choose the Service template
  2. Add a Run Shell Script action, and select /usr/bin/ruby in the Shell dropdown
  3. Paste the script and save
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .