Previously i used simple php mail() function to send emails. My main purpose is to get the receipt when the user reads the emails.
It works fine. I used this code and i perfectly got a receipt when user opens the emails via outlook.
here is my code that i have used.
Code: Select all
<?
$sitename = 'Contact Law';
$to_email = "abc@abc.com";
$from_email = "info@xyz.com";
$msg = "$sitename\n\n";
$msg .= "Email Recieved: $from_email\n";
$msg .= "Email Subject: $email_subject\n\n";
$msg .= "Message: $message\n\n";
$mailheaders = "Reply-To: <$from_email>\r\n";
$mailheaders .= "From: <$from_email>\r\n";
$mailheaders .= "Return-Path: <$from_email>\r\n"; //Return bounced emails to.
$mailheaders .= "X-Priority: 1\n"; //Message priority is set to HIGH
$mailheaders .= "X-MSMail-Priority: High\n"; //Message Priority for Exchange Servers
$mailheaders .= "Disposition-Notification-To: <$to_email>\r\n"; //Read receipt
$mailheaders .= "X-Mailer: PHP(".$_SERVER['REMOTE_ADDR'].")\r\n"; //IP address of who sent the mail
$mailheaders .= "Content-Type: text/HTML; charset=ISO-8859-1";
mail($to_email, $email_subject, $msg, $mailheaders);
?>
Here is my phpMAILER code
Code: Select all
$mailcomp = & new PHPMailer();
$mailcomp->Host = "CC";
$mailcomp->Mailer = "sendmail";
$mailcomp->Sender = $formEmailData['chemail'];
$mailcomp->IsHTML(true);
$mailcomp->AddAddress($formEmailData['clientemail']);
$mailcomp->AddCC($formEmailData['clientemailcc']);
$mailcomp->Subject = $formEmailData['subject'];
$mailcomp->Body = $formEmailData['clientmessage'];
$mailcomp->AltBody = $formEmailData['clientmessage'];
$mailcomp->Send();
thanks