Link to home
Start Free TrialLog in
Avatar of martyje
martyje

asked on

PHP, mailto syntax

I am trying to add "body" to mailto function, how do I add two values in two differnt lines. Here's how I am trying to do it.


$body = "Title: ". $title. "<br />". "Date: ". $date. "<br />";
print "<a href='mailto:someone@microsoft.com?subject=Hello%20again&amp;body=$body'> e-mail</a>"; 
 
It just prints the output as it is aong with the break tags, any suggesions?
ty

Open in new window

Avatar of psimation
psimation
Flag of South Africa image

print "<a href='mailto:someone@microsoft.com?subject=Hello%20again&amp;body=$body'> e-mail</a>";
needs to be:
print "<a href='mailto:someone@microsoft.com?subject=Hello%20again&body=$body'> e-mail</a>";
Avatar of martyje
martyje

ASKER

Still the same output: here's the output:
Title: Gymnast of the Week<br />Date: Mar 6 2008 <br />
Sorry, I cannot find any references on the net where you can send the content encoding via this method. I'm not sure it's possible to do this via a mailto: link. Using <br> in your body assumes that the e-mail client of the person clicking the link is set to HTML by default, but even if it is, I think you must explicitly send header information to the client to tell it to tell it to compile the message in HTML format. As it is, the client takes your body content "literaly" and does not attempt to "parse" the html.
 


ASKER CERTIFIED SOLUTION
Avatar of LordOfPorts
LordOfPorts
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of martyje

ASKER

Awesome... thanks much; works great.
Just curious, what exactly that ereg_replace function is doing?
Thanks much
Thank you for the grade and the points! The ereg_replace function http://us3.php.net/manual/en/function.ereg-replace.php allows you to replace a pattern identified by a regular expression, with a specified value. In this case the pattern states replace any new line (\n) or <br /> or <br> tags with the encoded value for a new line %0A, this is e.g. like %20 for space. The e-mail client recognizes the encoded value for a new line and inserts it at the appropriate location in the message body.
Avatar of martyje

ASKER

Thanks for the explaination :)