View Full Version : Multiple 'from' - headers issue

11-20-2010, 07:42 PM

Sofar I have this

$contact_name = $_POST['name'];
$contact_email = $_POST['email'];
$contact_subject = $_POST['subject'];
$contact_message = $_POST['message'];

if( $contact_name == true )
$sender = $contact_email;
$receiver = "your@email.com";
$client_ip = $_SERVER['REMOTE_ADDR'];
$email_body = "Hallo...,\n\n$contact_name, has visited your website and sends you the following question or remark: \n-----------------------------------------\n$contact_message \n-----------------------------------------\n\nContact details: \nName: $contact_name \nE-mailadres: $sender \nIP-adres: $client_ip \n";

$emailAutoReply = "Dear $contact_name, \n\nWe have just received your below question or remark:\n-----------------------------------------\n$contact_message \n-----------------------------------------\n\nWe thank you for your interest. As soon as your serious intentions are clear to us, we will contact you. \n\nregards,\n\nCOMPAGNY NAME \nuw your special store \nAddress..........\nTel.: 0000 - 000000 ";

$extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();
$autoReply = "From: $receiver\r\n" . "Reply-To: $receiver \r\n" . "X-Mailer: PHP/" . phpversion();

mail( $sender, "Auto Reply: $contact_subject", $emailAutoReply, $autoReply );

if( mail( $receiver, "Website reactie: $contact_subject", $email_body, $extra ) )
echo "success=yes";
echo "success=no";

What I would like is both mails in HTML. In all my efforts I get stuck with the headers which has to be set to sent mail in HTML
This part '$email_body' and this part '$emailAutoReply' should be sent as HTML. If not possible perhaps only '$emailAutoReply' in HTML (so I can include the company Logo) and the other one in plain text is possible?

Thanks for your help in advance

11-21-2010, 02:53 AM
you can of course send HTML+Text mails, though I would use a mailing library (http://swiftmailer.org/) for that (takes off the hassle of creating the necessary headers and boundaries)