i get clients who complain about weird characters
 Donation Receipt:
Â
If donor provided extra information, here is the information:
Â
this only happens on AOL. Or at least, seems to only happen there.
this is the mail call.
$headers .= "From: " . "Jewcer <info#myapp.com>" . "\r\n";
$headers .= "Reply-To: " . "info#myapp.com" . "\r\n";
$headers .= "From: " . "<{$fromEmail}>" . "\r\n";
$headers .= "Reply-To: " . "{$fromEmail}" . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $title, $content, $headers);
Any idea what might causing this problem? generally it works, just AOL and some other odd clients cause problems
the only thing that worked for me was this:
function utf8mail($to,$s,$body,$from_name="x",$from_a = "info#x.com", $reply="info#x.com")
{
$s= "=?utf-8?b?".base64_encode($s)."?=";
$headers = "MIME-Version: 1.0\r\n";
$headers.= "From: =?utf-8?b?".base64_encode($from_name)."?= <".$from_a.">\r\n";
$headers.= "Content-Type: text/plain;charset=utf-8\r\n";
$headers.= "Reply-To: $reply\r\n";
$headers.= "X-Mailer: PHP/" . phpversion();
mail($to, $s, $body, $headers);
}
from
https://stackoverflow.com/a/7267426/533426
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.
The one email From:support#lead.com works fine. But when changed to john.doe#lead.com it doesn't work? See below.
Both are valid email addresses (fictitious for this example) in the domain from which they are sent.
I have the question into Netfirms support too. I expect to move to phpmailer or API to a ESP (e.g., mailchimp) account soon, but this is just bugging me that the little change breaks the email function.
Code:
Works:
$headers = "Mime-Version: 1.0\n";
$headers .= "Content-Type: text/html;charset=UTF-8\n";
$headers .= 'From: support#lead.com' . "\r\n";
$headers .= 'Bcc: bcc#lead.com' . "\r\n";
// $headers .= 'Return-Path: bcc#lead.com' . "\r\n";
mb_internal_encoding("UTF-8");
if (!mail($to, $subject, $body, $headers, "-f bcc#mylead.com")) echo ("Message delivery failed");
Doesn't Work: (only changed support to john.doe):
$headers = "Mime-Version: 1.0\n";
$headers .= "Content-Type: text/html;charset=UTF-8\n";
$headers .= 'From: john.doe#lead.com' . "\r\n";
// $headers .= 'Return-Path: bcc#lead.com' . "\r\n";
mb_internal_encoding("UTF-8");
if (!mail($to, $subject, $body, $headers, "-f bcc#lead.com")) echo ("Message delivery failed");
Don't know how this really should matter, but you're mixing \n and \r\n in the headers, which may confuse your mail server... Would you mind to try this out?
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);
}
Is there any way to set the priority of PHP mail()? I looked at the online manual but I can't find any reference to it.
By priority, I mean High, Normal, Low or 1, 2, 3 in the headers. So the recipient knows the urgency of the mail.
Thank you!
That's usually done by setting following fields in the header:
"X-Priority" (values: 1 to 5- from the highest[1] to lowest[5]),
"X-MSMail-Priority" (values: High, Normal, or Low),
"Importance" (values: High, Normal, or Low).
See the following example (taken from php's mail function documentation):
<?php
$headers = "MIME-Version: 1.0\n" ;
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$headers .= "X-Priority: 1 (Highest)\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "Importance: High\n";
$status = mail($to, $subject, $message,$headers);
?>
<?php
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$headers .= "X-Priority: 1 (Highest)\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "Importance: High\n";
$status = mail($to, $subject, $message, $headers);
?>
From: http://www.php.net/manual/en/function.mail.php#91058
Call it with the X-Priority header in the 4th parameter:
mail ( $to, $subject, $message , "X-Priority: 1")
A comment on the PHP mail function documentation said:
<?php
$headers = "MIME-Version: 1.0\n" ;
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$headers .= "X-Priority: 1 (Highest)\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "Importance: High\n";
$status = mail($to, $subject, $message,$headers);
To define a mail priority you have to put this lines in the headers:
<?php
$headers = "MIME-Version: 1.0\n" ;
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$headers .= "X-Priority: 1 (Highest)\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "Importance: High\n";
$status = mail($to, $subject, $message,$headers);
?>
http://php.net/manual/en/function.mail.php
everything didn't work except this for my problem
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: xyz#example.com' . "\r\n";
$headers .= 'Cc: Admin#example.com' . "\r\n";
PS: email body must before the headers.