Mail rule to open url and save content of that webpage as pdf in local

I am trying to create a workflow that includes rules in OSX mail with applescript. Mission is to be able to save webpages from my iPhone on my mac as pdf, possibly even tagged for future searches.

Why I want this: I often find content on the web when I am on my iPhone that I would like to archive for future reference (save the page as pdf on my mac and that way make it searchable with spotlight). I am a heavy information user and have tried many methods, but all seem to break because I never have time to follow up my own reminders and go through email, open, save as pdf and tag.
I am therefore looking for a way that lets me only forward the actual webpage from my iphone to mail, tag it with something (“@”) that wakes the rule. I let applescript to take care of the rest. (Bonus if its possible to also tag document/filename with words from email content field.)

Unfortunately I am not that in to applescript as I should. Have found this on the web, but thats just half the part (found on

And I dont know if what I want is even possible to accomplish?

This is what my code looks like right now:


using terms from application "Mail"
on perform mail action with messages theMessages for rule Savepdf
tell application "Mail"
repeat with theMessage in theMessages
set theText to paragraph 1 of (content of theMessage)
set the clipboard to theText
end repeat
end tell

open location theText

end perform mail action with messages
end using terms from

Hi frankeman,

the first thing I would think about if I were you is outsourcing the Web to PDF conversion. It is certainly possible to convert webpages to html with AppleScript somehow, but I think using a free service like would be a lot easier.

You can email the URL directly to and you will receive a nice pdf file with all the layout and formatting intact. If you email this website for example, you will receive a pdf file called “macscripter-net.pdf”.

I would then setup a mail rule to handle emails received from It is easy to get the name of the attachment, maybe modify the file name (e.g. add current date and time) and then save the attachment somewhere.

Obviously, this would not be possible with the above mentioned concept, since web2pdfconvert does not return the original subject of the email.

Hope that was helpful.