Reputation: 1
I am doing a reset password for a site i just felt like doing, Ok So What I Am trying to insert a HTML 'A' Tag into my $message
Variable and show it in The Email i send out to where it will be a link
For Example:
$to = $torecoveremail;
$subject = "You Forgot Your Password At: " . $title;
$message = "
Your Username: " . $recoverusername . "
Your Email: " . $recoveruseremail . "
Your First Name: " . $recoveruserfname . "
Your Last Name: " . $recoveruserlname . "
Reset Password Follow This Link:
<a href=\"yourphotomake.info/shiylohs/cms/admin432/passreset.php?id=" . $passresetid . "\">Reset Password</a> ";
mail($to, $subject, $message);
and the out put from the email that is sent is:
Your Username: ben
Your Email: [email protected]
Your First Name: ben
Your Last Name: ben
Reset Password Follow This Link:
<a href="yourphotomake.info/shiylohs/cms/admin432/passreset.php?id=15">Reset Password</a>
And what I want the email out put to be is this:
Your Username: ben
Your Email: [email protected]
Your First Name: ben
Your Last Name: ben
Reset Password Follow This Link:
Reset Password
Thank You A Lot
Upvotes: 0
Views: 80
Reputation: 579
You have specify headers.
$to = $torecoveremail;
$subject = "You Forgot Your Password At: " . $title;
$headers = "From: [email protected]\r\n";
$headers .= "CC: [email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html><body>';
$message .= '<p>Your Username: ben</p>';
$message .= '<p>Your Email: [email protected]</p>';
$message .= '<p>Your First Name: ben</p>';
$message .= '<p>Your Last Name: ben</p>';
$message .= '<p>Reset Password Follow This Link:</p>';
$message .= '<p><a href="yourphotomake.info/shiylohs/cms/admin432/passreset.php?id=15">Reset Password</a></p>';
$message .= '</body></html>';
mail($to, $subject, $message, $headers);
For more options use PHPMAILER. Its very useful.
Upvotes: 1
Reputation: 14243
Be sure to include the Content-Type member in the 4th parameter. See the following example (slightly modified from php.net/mail):
<?PHP
$message = "<HTML><BODY><B>SOME HTML</B></BODY></HTML>";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
Also noted on PHP.net:
Note: If intending to send HTML or otherwise Complex mails, it is recommended to use the PEAR package » PEAR::Mail_Mime.
Upvotes: 2