Jump to content

simple question


spires

Recommended Posts

In order to send HTML code (that means <a href=... links) in an e-mail, you must let the script know that your message contains html. In theory, this should work:

[code]$link = '<a href="nickyrubin.com/members">login</a>';
$to      = $buyer_email;
$subject = 'Hi '.$firstname.', Nicky Rubin Would like to thank you';
$message = 'Hi '.$firstname.'
Thank you for buying from nickyrubin.com
Here is you username and password
USERNAME = '.$buyer_email.'
PASSWORD = '.$password.'
Please login here'.$link.'';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

mail($to, $subject, $message, $headers);
  $enter = '<div class="error">An email has been sent containing your username and password.</div>';[/code]

What is in the $headers variable lets the script know it should be formatted as HTML. Please note, however, that means that you must format the rest of your message in HTML. For example, you cannot just format a new line by using a return, you must use < br > (without the spaces) instead.

e.g.

[code]$link = '<a href="nickyrubin.com/members">login</a>';
$to      = $buyer_email;
$subject = 'Hi '.$firstname.', Nicky Rubin Would like to thank you';
$message = 'Hi '.$firstname.'<br>
Thank you for buying from nickyrubin.com<br>
Here is you username and password<br>
USERNAME = '.$buyer_email.'<br>
PASSWORD = '.$password.'<br>
Please login here'.$link.'';<br>
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

mail($to, $subject, $message, $headers);
  $enter = '<div class="error">An email has been sent containing your username and password.</div>';[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.