Page 1 of 1

Send mail in different colours using mail function

Posted: Fri Feb 06, 2009 3:42 pm
by me666
Hi i have set up my site so that it emails you a link and your info when you register and all works fine, the only thing is, i am looking to change the font colour in the email.
I have tried using the normal html font colour codes but that just displays as a code in the email rather than changing the colours.
Can any1 help me with thsi please?
Thanks :D

Re: Send mail in different colours using mail function

Posted: Fri Feb 06, 2009 4:03 pm
by mickeyunderscore
You need to send appropriate headers so the e-mail client knows that it is HTML and not plain text.

Couldn't remember what to put, so I looked this up from http://uk2.php.net/manual/en/function.mail.php:

Code: Select all

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, $subject, $message, $headers);

Re: Send mail in different colours using mail function

Posted: Fri Feb 06, 2009 4:05 pm
by Skoalbasher
mickeyunderscore wrote:You need to send appropriate headers so the e-mail client knows that it is HTML and not plain text.

Couldn't remember what to put, so I looked this up from http://uk2.php.net/manual/en/function.mail.php:

Code: Select all

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, $subject, $message, $headers);
I've beenwondering about this as well. That's awesome! Now how to send an HTML file that's already created and put that in the $message section.

Re: Send mail in different colours using mail function

Posted: Fri Feb 06, 2009 4:15 pm
by me666
excelent thanks, i tried sending mail via html before so i could use the </br> syntax to new line but wouldnt work, thanks for the response.
And the last question, i expect if your using php it would be something like using the include comand or the '$text = file_location/file_name'
not sure but just a guess

Re: Send mail in different colours using mail function

Posted: Fri Feb 06, 2009 4:39 pm
by Skoalbasher
me666 wrote:excelent thanks, i tried sending mail via html before so i could use the </br> syntax to new line but wouldnt work, thanks for the response.
And the last question, i expect if your using php it would be something like using the include comand or the '$text = file_location/file_name'
not sure but just a guess
Yeah, I'm gonna look around for it. Nothing pressing yet. You know if you just want a new line, you could seperate with a "\n" that works in emails.

Re: Send mail in different colours using mail function

Posted: Fri Feb 06, 2009 4:41 pm
by me666
yea found that on the net too.... only thing is if i use that in my php created email it dosent send and i get a delivery failer after 5 attempts of sending it, not sure why as this is the only solution i found on the net
thanks anyways

Re: Send mail in different colours using mail function

Posted: Fri Feb 06, 2009 4:44 pm
by mickeyunderscore
Does the mail() function fail? Or is it just undelivered?

Re: Send mail in different colours using mail function

Posted: Sat Feb 07, 2009 2:39 am
by me666
just undelivered, i get an email in my inbox of the senders email address saying it tried 5 times but failed