Embedding a clickable url into Mail message contents

Hi,

Is there a way of embedding a clickable url into a Mail message contents ?

The return from the script below returns the web link as text.

I would like it to-be a clickable url.

What can I do to achieve this ?

set em1 to "valdelpucci"
set Sub to "Boat Show"
set vne to "The Docks"
set N1 to "Joe"
set Nen1 to "Joe Blogs"
set Nead1 to "joeblogs@yahoo.com"
set evt to "Boat Show"
set dte to "Monday, 2nd August"
set tme to "7.30pm"
set wb to "http://www.theboatshow.com/"

set cm1 to "Hi  " & N1 & "," & return & return & "Will you come to the " & evt & " on " & dte & " in the " & vne & " at " & tme & ". All the details can be be found at " & wb & " " & return & return & "Cheers" & return & return & "Val"
tell application "Mail"
	set newMessage1 to make new outgoing message with properties {subject:Sub, sender:em1, content:cm1, visible:false}
	tell newMessage1 to make new to recipient at end of to recipients with properties {name:Nen1, address:Nead1}
	save newMessage1
end tell

-----Hi  Joe,

-----Will you come to the Boat Show on Monday, 2nd August in the The Docks at 7.30pm. All
----the details can be be found at http://www.theboatshow.com/ 

-----Cheers

----Val

Val

From what I see so far, Mail does this automatically.

The mails appear to arrive with a clickable url.

Val

Hello Val!

Maybe this can help you a little. Embed your link in html, then convert it to an rtf-link, than paste it to the clipboard,
then insert the contents of the clipboard to the contents of the message.

I used this for creating rtf links for file aliases I see no reason that you should not be able to rework it to insert an http:// url instead of a furl. You must send an rtf formatted mail, but I guess you knew that from before. :wink:

Edit: I do not know what you do mean by automatically. I can’t get to the boat show by clicking on the inserted link from your script, having said that, I have problems with attachments not showing up as well, so
my Mail.app isn’t exactly the reference applet.


on rtfLink(anAlias)
   -- totally stolen from http://www.macosxhints.com/article.php?story=20091002090934432
   -- I have a shell file - rather compact, but I can't figure out where that leading zero comes from.
   -- I'll come back and revise this one as well.
   local _msglnk
   set _linkText to extract_shortname_from(extract_filename_from(anAlias as text)) as text
   tell application "Finder" to set _msglnk to URL of (anAlias as alias)
   set startEcho to "echo "
   set echoDelimiter to "'"
   
   set html_1 to "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n<meta http-equiv=\"Content-Style-Type\" content=\"text/css\">\n<title>"
   set html_2 to "</title>\n<meta name=\"Generator\" content=\"Cocoa HTML Writer\">\n<meta name=\"CocoaVersion\" content=\"1038.11\">\n<style type=\"text/css\">\np.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}\n</style>\n</head>\n<body>\n<p class=\"p1\"><a href=\""
   set html_3 to "\">"
   set html_4 to "</a></p>\n</body>\n</html>"
   
   set echoCommand to startEcho & echoDelimiter & html_1 & _linkText & html_2 & _msglnk & html_3 & _linkText & html_4 & echoDelimiter
   set textutilCommand to " | textutil -convert rtf -inputencoding UTF-8 -format html -stdin -stdout"
   set pbcopyCommand to " | pbcopy -Prefer rtf"
   
   set entireCommand to echoCommand & textutilCommand & pbcopyCommand
   
   do shell script entireCommand
   copy (the clipboard) to theResult
   return theResult
end rtfLink

Best Regards

McUsr

Hello.

A second thought: Maybe it is possible to attach a webloc renaming the webloc to “Watch the Boatshow” or something?

Best Regards and Nice Summer Nyte

McUsr

Many thanks.

McUsr wrote

.

But just send yourself an email with Mail.

include http://www.theboatshow.com/.

It will arrive as a clickable url.

I should not have posted the original query without first checking.

Cheers,

Val

Hello

I fancied that when looking in my sent box, but thank you.

It was an interesting question anyway Val. Because If I enter an url manually into a new message, it doesn’t appear as clickable at all. But I’ll have a go in my sent box and see.

Edit: Using a webloc, If you had made a nice thumbnail of the page containing the webloc (haas has made a program for doing that), then you could get quite a nice link. “click the picture”.

Still nice summer night! (I wish I was a fisherman - stumblin on the sea.)

Best Regards

McUsr

Here’s a good way to create a link. See my post #8 here.

This link-creator creates a link that’s usable in many programs, including email. I like it because it creates an rtf link on the clipboard that you can paste almost anywhere. But the nice feature is that you input a word to represent the link, so you don’t have to show the full link… like I did above with the word “here”. When you send this link through email it’s clickable like normal. When creating the email you can hover your mouse over the word for the link and the true link is displayed. It works good. Maybe you’ll like it.

Hello.

That was a real nice one Hank.

That was in essence what I meant to use the snippet I got for, but yours is already made.
Funny that I never found that post!

Best Regards

McUsr

I figured that because when I read your post that’s what made me think of that script. :smiley:

Wow ! The regulus6633 script is something else !

But Is there any way to automatically insert “here” or " click here" etc with a script into an outgoing message .

click here

instead of

text of urls such as http://www.theboatshow.com/ as supplied by a script ???

Way beyond my capabilities but I think I can still rely on the text link being converted by Mail.

But still it would be some feat!

And how did you get it to do this.

regulus6633 wrote in post 7

I can manually, with your script, get “here” or “click here” etc into a Mail Message as a clickable url but not into this post!

Val

Hello Val

Do you mean like this: Click here to see your previous post? You didn’t mean that. Edit:If you did mean that, -I guess Hanks rtf-link was converted to a usual < a href = addr > “click here” < / a > when he pasted it into a MacScripter Edit Window.
By the way, I have made a nice little tool for inserting BBCode into a variety of editors, including Safari, which you can find here :wink:

I guess you have read the script you too, you just concatenate the link and the text to represent the link into an rtf-string which is then pasted as rtf to the clipboard, which you then can paste into a mail. The nifty thing is is that mail signatures is also rtf or webarchieve to be more precise, but still editable in TextEdit as rtf, so you can just past the link in there.,-So you could put such a link into the signature, and just choose to use that signature every time you would send a mail with a reference to that link.

For more info on creating mail signature you may visit macosxhints.com
you may also find this snippet I made for creating mail signatures helpful

Best Regards

McUsr

As in click here

Lets see

Val