I have a contact form that generates an email. If the customer has an Hotmail account (that I put in the Reply-To part of the header) then the email is not sent, any other email address is fine and the email sends without a problem.
For example:
if $contactEmail is mail#hotmail.com the email is not sent.
if $contactEmail is mail#site.com the email is sent.
Here is my Header ...
$headers = "From: My Site <info#mysite.com>\r\n";
$headers .= "X-Sender: <info#mysite.com>\r\n";
$headers .= "Reply-To: $contactEmail\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$headers .= "X-Mailer: PHP4\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "Return-Path: <info#mysite.com>\r\n";
Any thoughts/advice please?
Thanks.
As per the PHP manual regarding sending HTML mail, try adding the "to" header:
$headers = "From: My Site <info#mysite.com>\r\n";
$headers .= "To: Whoever <whoever#othersite.com>\r\n";
$headers .= "X-Sender: <info#mysite.com>\r\n";
$headers .= "Reply-To: $contactEmail\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$headers .= "X-Mailer: PHP4\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "Return-Path: <info#mysite.com>\r\n";
Try jerdiggity's answer first and check if the mail ends in the junk folder. Microsoft's SmartScreen spam technology is very hard to come by. You have to create an DNS SPF record and “un-junk” some mails in order to get your IP whitelisted.
Related
I have this php code for mail.
Everythings working fine but the CC part is not working
$headers = "From:".$from."\r\n";
$headers.= "Cc: dainest7138#gmail.com\r\n";
$headers.= "MIME-Version: 1.0\r\n";
$headers.= "Content-Type: text/html; charset=utf-8\r\n";
$headers.= "X-Priority: 1\r\n";
mail($to_mail, $subject2, $mess2, $headers);
Now the mail is being recieved at the address defined in from. The content and all other things are fine but no mail is being recieved on the address defined in "CC" part.
Please Help me understanding the problem.
Thank You
Try this:
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From:'.$from. "\r\n";
$headers .= 'Cc: dainest7138#gmail.com' . "\r\n";
mail($to_mail, $subject2, $mess2, $headers);
Re-edited it. Try this one.
When I use headers like this, I cant receive the email that I send to myself
$headers = "From: 123#example.com \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html;charset=ISO-8859-1\r\n";
$headers .= "'X-Mailer: PHP/' . phpversion();";
but when I use this header just like this:
$headers = "From: 123#example.com \r\n";
I can receive the email that I send to myself.
Can anyone tell me whats wrong with it?
i'm using following code to send confirmation mail, but i dont know why the url parameter in mail removed
and in mail i'm getting url like http://example.com/confirm.php?user_id= parameter value (1) is being removed
$headers = "From: admin#example.com \n";
$headers .= "X-Mailer: PHP/SimpleModalContactForm";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=utf-8\n";
$headers .= "Content-Transfer-Encoding: quoted-printable\n";
$subject = "Confirm Your Registration Example.com";
$subject = mb_encode_mimeheader($subject, "UTF-8", "B", "\n");
$to="abc#demo.com";
$body="<table> <tr> <td> Hello </td> </tr>";
$body.="<tr> <td> Please confirm your registration by clicking following link <td> </tr>";
$body.="<tr> <td> http://example.com/confirm.php?user_id=1</td> </tr>";
$body.="</table>";
#mail($to, $subject, $body, $headers) or die("Unfortunately, a server issue prevented delivery of your message.");
Did you try with a tag like
http://example.com/confirm.php?user_id=1
solved,
just changed headers from
$headers = "From: admin#example.com \n";
$headers .= "X-Mailer: PHP/SimpleModalContactForm";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=utf-8\n";
$headers .= "Content-Transfer-Encoding: quoted-printable\n";
to
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: admin#example.com' . "\r\n";
function sendEmail($address,$subject,$message)
{
$headers = "Reply-To: miloAds Team <admin#miloads.com>\r";
$headers .= "Return-Path: miloAds Team <admin#miloads.com>\r";
$headers .= "From: miloAds Team <admin#miloads.com>\r";
$headers .= "Organization: Milonas Media LLC\r";
$headers .= "MIME-Version: 1.0\r";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r";
$headers .= "X-Priority: 3\r";
$headers .= "X-Mailer: PHP". phpversion() ."\r";
mail($address, $subject, $message, $headers);
}
When sending out an email, the header is appearing in the body.
Try changing each of the \r escapes to \r\n and see if that helps.
Quoth the PHP manual:
additional_headers (optional)
String to be inserted at the end of the email header.
This is typically used to add extra headers (From, Cc, and Bcc).
Multiple extra headers should be separated with a CRLF (\r\n).
Make sure to not include the trailing \r\n on the last header either.
Also make sure to strip any newlines from the $subject as that could cause problems. See if those help.
Add \n to \r, i.e. \r\n and remove the last one:
function sendEmail($address,$subject,$message)
{
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "From: miloAds Team <admin#miloads.com>\r\n";
$headers .= "Reply-To: miloAds Team <admin#miloads.com>\r\n";
$headers .= "Organization: Milonas Media LLC\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Mailer: PHP". phpversion();
mail($address, $subject, $message, $headers);
}
I have an HTML email needed to be sent to more than one person:
$mem = "abc#def.com, qwr#rty.com";
$subject = 'Invitation to Party';
$headers = "From: info#example.com\r\n";
$headers .= "Reply-To: info#example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "SNIPPED";
mail($mem, $subject, $message, $headers);
It is sending to the first email which is abc#def.com, but it's not sending mail for the second recipient which is qwr#rty.com and the rest.
The email addresses are examples.
Is there any work-around for this besides using library?
you may send the second id as a bcc,
$headers .= "Bcc: ".$bcc."\r\n";