Page 1 of 1

$mailcontent formatting (line breaks, text color, bold etc.)

Posted: Sat Sep 26, 2009 11:48 am
by edawson003
I got a registration page that sends a welcome email and I have the basics down already

Code: Select all

 
$toaddress = $_POST['email'];
   $subject = 'Welcome to mysite.com';
   $mailcontent = 'Welcome '.$fname."\n"
   .'Your username is: '.$_POST['username']. "\n"
   .'To begin, please login and begin setting up your profile'."\n";
   $fromaddress = 'From: newaccounts@mysite.com';
   mail($toaddress, $subject, $mailcontent, $fromaddress);
 
Now, I would like to spruce up the email message a bit (i.e. add bold to certain content elements, colored text, line breaks). How can I pull this off?

I tried this with no success: $mailcontent = 'Welcome '.$fname.'<br>'"\n"

Also, I would like to:
(1) get an email every time someone registers
(2) Add a clickable link back to my site to the mail content

Re: $mailcontent formatting (line breaks, text color, bold etc.)

Posted: Sat Sep 26, 2009 2:34 pm
by requinix
You need to send an HTML email. Take a look at the examples on the manual page.

Re: $mailcontent formatting (line breaks, text color, bold etc.)

Posted: Sat Sep 26, 2009 4:54 pm
by edawson003
Perfect! Just what I need. Thanks!