Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Mailto to mail page link

Status
Not open for further replies.

DreamerZ

Programmer
Jul 11, 2001
254
US
I have read a few of the posts here on using mailto and am familiar with the formatting. What I'm having difficulty with is the location string itself. Here's the code:

Code:
window.location='mailto:$ra_Mgr?subject=Open Rework Issue&body=[URL unfurl="true"]http://test2s:8181/jfe/cm_test/ra/index.phtml?ra_Issue=3&ra_Key=96';[/URL]

First thing, I am using PHP as well as the Javascript so if there is a fix with PHP, I'm open to that too.
Second, the above code works fine, EXCEPT for the &ra_Key line. I know it's because the mailto sees the & as another segment of the message (link &body).

The body, in other words, only shows:
"...test2s:8181/jfe/cm_test/ra/index.phtml?ra_Issue=3"

So, how do I get the full link to show in the body? I have tried the various codes for the ampersand (&, etc.) to no avail.

Thoughts? Thanks,



DreamerZ
 
This should work for you:

Code:
window.location = 'mailto:$ra_Mgr?subject=Open Rework Issue&body=' + escape('[URL unfurl="true"]http://test2s:8181/jfe/cm_test/ra/index.phtml?ra_Issue=3&ra_Key=96');[/URL]

The escape function convets characters to 'URL safe' codes - the code for the ampersand being %26.

Hope this helps,
Dan
 
Works great! Thanks. I'll have to look up the escape function now. Thx again.


DreamerZ
 
Found another issue with this location=mailto: syntax. Hopefully, someone can help.

I am pulling data from a flat file with PHP. I then want to be able to click a button to create an e-mail message to send with the data without having to open a new window and then the e-mail message.

Code:
window.location='mailto:?subject=$reportHead $filterText between $str_Start and $str_End.&body=' + escape(output);

The above code works fine...as long as there are only 25 records. The actual error might be in the number of characters stored in the variable. I need to know if there is a function that removes any length limitations. Is it the type of variable I'm using? I haven't assigned output to anything special, just var output.

Thoughts? TIA


DreamerZ
 
I would say it is a combination of browser, operating system, and mail package.

Because there are no standards (AFAIK) for a "mailto:" link to define the length of things, you're probably not going to find a straighforward answer.

Personally, when I've had this issue before (which normally happens when using Lotus Notes as the mail client), I generate an email with a unique ID (UUID / GUID) in it, which the user clicks on to take them through to a web page with their "real" message on.

Hope this helps,
Dan
 
is it possible to embed a link in the body of an email using mailto()

something like

<A href="foo.com">test</A>

to appear in body?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top