Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Open email client and use HTML link

Explorer ,
May 15, 2012 May 15, 2012

How does one open an email client and embed a body with HTML, so links will work.

I have tried:

var request:URLRequest = new URLRequest("mailto:someemail@somewhere.com?subject=some subject Results"+"&body="+"<A=href=3Dhttp://www.somelink.com</A>"

navigateToURL(request, "_self");

This is not to be sent to a php page, but load the user's Email Client.

TOPICS
ActionScript
2.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 15, 2012 May 15, 2012

What you tried should work when written properly and you should test in a browser.  As shown, it is missing a closing parenthesis for the URLRequest definition, and the html link is not written correctly. 

var request:URLRequest = new URLRequest("mailto:someemail@somewhere.com?subject=some subject Results"+"&body="+"<A href=\"http://www.somelink.com\">3D?</A>");

navigateToURL(request, "_self");

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 15, 2012 May 15, 2012

Thank you Ned. I did mess that up when I put it in this post.

However, yours does not work either.

When the email opens, it is in html as the Plain Text button option is there.

Do you see anything wrong with what you had in that request?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 15, 2012 May 15, 2012

Using URL notation to specify an emails contents you can't force a user to use rich text. Some have their clients to default to plain text. Therefore it will just show the HTML. There is no guaranteed way to achieve this.

If the user has rich text set as default a link being injected typically auto-links anyhow. You may not SEE it as a hyperlink but send the email and the receiving users computer should see it as a hyperlink.

So try:

var request:URLRequest = new URLRequest("mailto:someemail@somewhere.com?subject=some subject Results&body=http://www.somelink.com");

Then send that email to yourself. You should see it appear as a hyperlink automatically, as long as you have rich text mode enabled. Otherwise no matter what you send a plain text user will never see your hyperlink anyhow as it strips HTML out.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 15, 2012 May 15, 2012

Thank you as well sinious.

But that also did not work for me.

My email client receives html email fine but not when sent like this.

I have tried 2 different computers. They have the option to turn the email to Plain Text, meaning they are already in rich text.

Does the line you you supplied work for you? Or anyone else?

I understand about the not being able to force the user to use Rich Text. Thjat will not be a problem for this case.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 16, 2012 May 16, 2012

Try something like this:

var urlStr:String = encodeURI("http://www.somelink.com");

var mailMsg:URLRequest = new URLRequest("mailto:");

var variables:URLVariables = new URLVariables();

variables.subject = "Some subject";

variables.body = urlStr;

mailMsg.data = variables;

mailMsg.method = URLRequestMethod.GET;

navigateToURL(mailMsg);

I've created requests like this on iPad and it works perfectly fine. Only real difference is encoding the URL. I receive links, not plain text. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 16, 2012 May 16, 2012

Well, it seems that some email clients show it without the hyperlink regardless of if it is set to Rich Text.

Now, I am talking about the sending of the email here, not the receiving. So I will live with that.

However, I also get a blank browser page before it opens the email client. Is there a way to avoid this?

Thanks for the assistance.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 16, 2012 May 16, 2012

Unfortunately no, you're asking the OS to open a browser by using navigateToURL. The browsers is the means by which you open the email so it must be loaded. Back in the day you could write some JavaScript to the browser that opens to trigger the email then close itself but browsers all prevent anything but child windows to be closed via JS.

You can't get at the raw data under the email with the simple URL arguments you can pass.

What is your context? Is this a flash website? A projector? AIR application? App?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 16, 2012 May 16, 2012

Flash website app.

I am trying to avoid using a php script but might if need be.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 16, 2012 May 16, 2012
LATEST

The cleanest is always going to be making your own email via PHP. Then you can use the HTML.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines