Hi,
I want to send a HTML-mail.
I know to use the mail-function.
But it only send text, not in HTML format.
Thanks,
SOLVED: How to send a HTML mail
SOLVED: How to send a HTML mail
Last edited by mister_v on Wed Feb 09, 2011 8:04 pm, edited 1 time in total.
Re: How to send a HTML mail
With PHP it is easily done.
You create the body of your message in html.
Don't forget <html><body></body></html>
and in the headers you tell it is a HTML-mail with the following line:
So the complete code looks something like this:
If you have more questions, just let me know.
You create the body of your message in html.
Don't forget <html><body></body></html>
and in the headers you tell it is a HTML-mail with the following line:
Code: Select all
Content-type: text/html\r\n
Code: Select all
$email='someone@somewhere.com';
$subject='This is the Subject;
$headers = "From: me@here.com\r\n";
$headers .= "Content-type: text/html\r\n";
$body='<html><body><h1>My HTML mail:</h1>and the rest of the mail</body></html>';
mail($email,$subject,$body,$headers);