How can I send a hyperlink with an email?

I want to send in an email body ( I create email with native.showPopup() or with system.openURL() command) the string “our site” that if user clicks on it, he redirects to our company site.

Is it possible? Thanks [import]uid: 172733 topic_id: 33846 reply_id: 333846[/import]

The message that you pass to the showPopup event would have to be written as html. Below is an example from the showPopup documentation that adds a Our Site link that points to coronalabs.com. It’s semi-psuedo code so just fix any syntax errors if you get any.

[lua]local myBodyText ="[html] I scored over 9000!!! Can you do better?
[local options =
{
to = “john.doe@somewhere.com”,
subject = “My High Score”,
body = myBodyText
attachment = { baseDir=system.DocumentsDirectory, filename=“Screenshot.png”, type=“image” },
}
native.showPopup(“mail”, options)[/lua]

Making HTML emails through code has always been a fairly messy experience for me. With my day job doing ASP stuff I end up having to do it quite a bit. What I typically do with any lengthy email is create a text file with all my html code in it and just read it into a string and do a replace(string.gsub in Lua) on any custom fields. [import]uid: 147305 topic_id: 33846 reply_id: 134540[/import] ](http://www.coronalabs.com%20>%20Our%20Site%20%5B/html%5D)

@budershank’s idea is what you need to do, but if you don’t mind @budershank, let me touch this up a bit.

local myBodyText =[[[html] I scored over 9000!!! Can you do better?   
 [Our Site](http://www.coronalabs.com)[/html]]]  
local options =  
{  
 to = "john.doe@somewhere.com",  
 subject = "My High Score",  
 body = myBodyText  
 attachment = { baseDir=system.DocumentsDirectory, filename="Screenshot.png", type="image" },  
}  
native.showPopup("mail", options)  

I’m using Corona’s double square bracket’s for my string quotes since I need the normal double quotes inside the string. You also needed to close quotes on the URL.

Now a little bit of commentary… HTML and Email poses some very unique challenges. Microsoft for some reason (well I know why, but it’s a stupid reason) changed Outlook (their popular email client) to no longer use the Internet Explorer HTML rendering engine in favor of the Microsoft Word rendering engine several years ago. Instead of moving Outlook into the 21st century, they sent it back to the 1990’s as Word’s rendering engine is the worst on the planet. CSS and <div>'s for formatting just doesn’t work well. HTML5 and CSS3 bits are not going to work and a lot of CSS2 is questionable for those running Outlook. Trying to build rich emails is not fun. But simple links and such should work just fine.
[import]uid: 199310 topic_id: 33846 reply_id: 134557[/import]

@Rob Miracle, @budershank
I tried it now and I see email message body with html tags ( I opened received mail in gmail from safari on mac and in gmail on Galaxy S2) [import]uid: 172733 topic_id: 33846 reply_id: 134593[/import]

The message that you pass to the showPopup event would have to be written as html. Below is an example from the showPopup documentation that adds a Our Site link that points to coronalabs.com. It’s semi-psuedo code so just fix any syntax errors if you get any.

[lua]local myBodyText ="[html] I scored over 9000!!! Can you do better?
[local options =
{
to = “john.doe@somewhere.com”,
subject = “My High Score”,
body = myBodyText
attachment = { baseDir=system.DocumentsDirectory, filename=“Screenshot.png”, type=“image” },
}
native.showPopup(“mail”, options)[/lua]

Making HTML emails through code has always been a fairly messy experience for me. With my day job doing ASP stuff I end up having to do it quite a bit. What I typically do with any lengthy email is create a text file with all my html code in it and just read it into a string and do a replace(string.gsub in Lua) on any custom fields. [import]uid: 147305 topic_id: 33846 reply_id: 134540[/import] ](http://www.coronalabs.com%20>%20Our%20Site%20%5B/html%5D)

@budershank’s idea is what you need to do, but if you don’t mind @budershank, let me touch this up a bit.

local myBodyText =[[[html] I scored over 9000!!! Can you do better?   
 [Our Site](http://www.coronalabs.com)[/html]]]  
local options =  
{  
 to = "john.doe@somewhere.com",  
 subject = "My High Score",  
 body = myBodyText  
 attachment = { baseDir=system.DocumentsDirectory, filename="Screenshot.png", type="image" },  
}  
native.showPopup("mail", options)  

I’m using Corona’s double square bracket’s for my string quotes since I need the normal double quotes inside the string. You also needed to close quotes on the URL.

Now a little bit of commentary… HTML and Email poses some very unique challenges. Microsoft for some reason (well I know why, but it’s a stupid reason) changed Outlook (their popular email client) to no longer use the Internet Explorer HTML rendering engine in favor of the Microsoft Word rendering engine several years ago. Instead of moving Outlook into the 21st century, they sent it back to the 1990’s as Word’s rendering engine is the worst on the planet. CSS and <div>'s for formatting just doesn’t work well. HTML5 and CSS3 bits are not going to work and a lot of CSS2 is questionable for those running Outlook. Trying to build rich emails is not fun. But simple links and such should work just fine.
[import]uid: 199310 topic_id: 33846 reply_id: 134557[/import]

@Rob Miracle, @budershank
I tried it now and I see email message body with html tags ( I opened received mail in gmail from safari on mac and in gmail on Galaxy S2) [import]uid: 172733 topic_id: 33846 reply_id: 134593[/import]

I’m having trouble getting hyperlinks to work. My email options passed to the native.showPopup function are as follows:

emailOptions = { subject = "My App", isBodyHtml = true, body = [[\<html\>\<body\> Check out my cool stuff \<a href="]]..myCoolStuffUrl..[["\> here. \</a\>\</body\>\</html\>]], attachment = { baseDir=system.ResourceDirectory, filename = "Icon@2x.png", type="image" }, }

The myCoolStuffUrl variable will be a string which contains the url with some params that will show some custom data when they go to our webpage, so I can’t use a fixed string value.

However when I receive the email I just see this:

Check out my cool stuff here. &nbsp;

and there is no hyperlink.

Have I missed something obvious?

Edit: it still doesn’t work even if I hardcode the value to:

body = [[\<html\>\<body\> Check out my cool stuff \<a href="http://www.google.com"\> here. \</a\>\</body\>\</html\>]],

I’m having trouble getting hyperlinks to work. My email options passed to the native.showPopup function are as follows:

emailOptions = { subject = "My App", isBodyHtml = true, body = [[\<html\>\<body\> Check out my cool stuff \<a href="]]..myCoolStuffUrl..[["\> here. \</a\>\</body\>\</html\>]], attachment = { baseDir=system.ResourceDirectory, filename = "Icon@2x.png", type="image" }, }

The myCoolStuffUrl variable will be a string which contains the url with some params that will show some custom data when they go to our webpage, so I can’t use a fixed string value.

However when I receive the email I just see this:

Check out my cool stuff here. &nbsp;

and there is no hyperlink.

Have I missed something obvious?

Edit: it still doesn’t work even if I hardcode the value to:

body = [[\<html\>\<body\> Check out my cool stuff \<a href="http://www.google.com"\> here. \</a\>\</body\>\</html\>]],