$to = "firstname.lastname@example.org";
$subject = "Test html based email";
// your message is now in HTML
$msg = "
<H1 ALIGN="CENTER">Look how cool this is!</H1>
/* to adhere to the standards defined in RFC 5321 and RFC 5322
The email client must meet the following criteria:
The header lines of the email must contain exactly one valid "Date" line according to RFC 2822.
The following header lines may only exist once: From, Sender, To, CC, Subject
The header lines mentioned must be syntactically correct
Note: The To and CC lines can contain multiple recipients.
// add email header
$header = "Content-type:text/html;charset=UTF-8" . "\r\n";
// add the from line
$header .= "From: mycompany.com <email@example.com>\r\n";
// to be RFC 2822 compliant you must have a date in the header
$header .= "Date: " .date("D, d M Y H:i:s O");
mail($to, $subject, $msg, $headers);
I want to add a form to an html email - is that possible?
You can add anything you want to the email. Just add the form to the $msg variable with all of the html already there. In the end it is all html anyway.
$msg = "
<H1 ALIGN=CENTER>Look how cool this is!</H1>
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.