link inside mailto body

  You are currently not logged in. You can view the forums, but cannot post messages. Log In | Register

04-Aug-12 15:16
Hi Matt,

I would like to ask you if you know a sample code of how i can create a link or an image link inside a body of a mailto. I'm going use this inside a web app.

I don't know how to do it on php.

Regards,

MBarcala
05-Aug-12 03:45
It is exactly the same as as you would create any link, and for PHP to print() or echo() the string to the mail body, you simply wrap it in single quotes (') to make it into a string value as you would for a variable.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/
05-Aug-12 12:45
Thanks Chris,

this is exactly what happening with my situation. I just trying the link look like a link and in my case the html link tag look as plain text when I receive the email

my code sample:


<?php
$name = " Mike ";
$subject = "Wonderful Day!!!";
$address = "http://www.google.com";
$message = "
Your friend $name is inviting you to visite our site at.<br/><br/>
<a href='{$address}'>Click here to join us</a>
";
echo '<a href="mailto:?subject=' . $subject . '&body=' . $message . '">Share</a>';
?>


this is the main idea of what i'm trying to do but not good result at the moment, could you tell me what could be wrong that i don't get the result I want
06-Aug-12 09:02
Well, to use HTML code in emails you have to tell the client they have been sent as HTML not as Plain Text.

assuming you have already set some headers, you need to add a ContentType header to the message.


$headers .= "Content-type: text/html\r\n";


Which will ;tell' the email client that the message contains HTML code and should be rendered as such.

Depending or your application you might want to send the message as both plain text AND HTML in the same message. This is a bit more complicated as you have to format the message as a "multi-part message" if your server has the PEAR libraries installed ( http://pear.php.net ) there are some routines to handle message creation
http://pear.php.net/packages.php?catpid=14&catname=Mail

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/
13-Sep-12 13:25
Hi Chris,

sorry to bother you again about this situation, i did incorporate the headers to be able to display things in html but I can't figure out how to place in the "echo part" I try many options but not happy ending would you mind to give me an idea how it can be done this echo part including the headers too???

regards

mbarcala
17-Sep-12 08:36
to place in the "echo part" ???

How to place .. what .. in the echo part??

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/
17-Sep-12 08:48
Ok, this is my code with the headers part include, now how I place the "headers part" inside echo? so once I click "Click here" the headers part will let my message well formatted.


<?php
$name = " Mike ";
$subject = "Wonderful Day!!!";
$address = "http://www.google.com";
$message = "
Your friend $name is inviting you to visite our site at.<br/><br/>
<a href='{$address}'>Click here</a>
";
$headers .= "Content-type: text/html\r\n";


//here is the echo part that i mention
echo '<a href="mailto:?subject=' . $subject . '&body=' . $message . '">Share</a>';
?>


regards

mbarcala
22-Sep-12 18:07
The headers are not "echo"ed to the message, the headers are concatenated and passed as a paremeter to the mail function.

http://php.net/manual/en/function.mail.php

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/

 
New posts
Old posts

Follow Elated