At my company, we have had several clients claim that their order confirmation emails are coming through just as the HTML source, not formatted at all. However the majority of our clients are receiving their emails through fine.
I think I may have found a link which explains why only some clients receive the unformatted email, however I'm not sure of the cause. It seems that users with a custom domain name for their email address are experiencing the problems and regular email domains such as #gmail.com or #icloud.com are working fine.
The problem is not related to the client used to view the email as I have been able to replicate the problem with my private domain name and the source code is displayed in all clients.
Any idea what would be the cause of this?
Here are my headers:
$headers = "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1";
Try following headers for HTML Email...
$from = $from . ' <' . $from . '>';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=utf-8" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$headers .= 'Reply-To: ' . $from . "\r\n";
$headers .= 'Return-Path: ' . $from . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
$headers .= 'X-Originating-IP: ' . $_SERVER['SERVER_ADDR'] . "\r\n";
Related
How to send email using php with sender name and email address by without server name ?
I want to send email with name : NUMBERONE and email address : admin#NUMBERONE.com
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From:NUMBERONE(admin#NUMBERONE.com)\r\n";
mail($to, $subject, $message, $headers);
I try above code , it's not send email. How can i do that ?
Example #4 in the documentation for PHP mail() function answers your question.
// Additional headers
$headers .= 'To: Mary <mary#example.com>, Kelly <kelly#example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday#example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive#example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck#example.com' . "\r\n";
In your case it should be:
$headers .= 'From: NUMBERONE <admin#NUMBERONE.com>' . "\r\n";
I am sending email through PHP and I want to change the "sent by" email in the headers:
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: test#test.com' . "\r\n";
$headers .= 'Reply-To: test#test.com' . "\r\n" .'X-Mailer: PHP/' . phpversion();
I am also attaching the image for reference:
I want to change the highlighted email address. Thanks in advance
I'm making a form, when it submits it sends you a HTML email with a confirmation that you submitted it correctly.
When I receive the email; the content type header is inside the body of the email and the HTML code is displaying as raw text.
Screenshot:
Here is my code:
$to = 'myemail#gmail.com';
$subject = "HTML email";
$body = "<html><body><h1>Hello world!</h1></body></html>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: <webmaster#website.com/>' . "\r\n";
mail($to, $subject, $body, $headers);
Could anyone please tell me what exactly is going wrong?
Thank you
Change your below three lines
From
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: <webmaster#website.com/>' . "\r\n";
To
$headers = "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-type:text/html;charset=iso-8859-1" . PHP_EOL;
$headers .= 'From: <webmaster#website.com/>' . PHP_EOL;
I think after that this will work properly
Basically I need to notify certain users of something happening in the application.
I bring the users from the database, everything works fine, but when i send the emails, only the first one in the list receives it, I tried switching the order they are brought, and still, so is not about a particular mail client.
I tried sending one by one and now sending all together and neither seems to work.
Have this ever ocurred before? I'm using some amazon server, with linux, but is a client's client's server so i can't really stick my head all over the config.
$ul = $this->q2ar("SELECT * FROM usr WHERE role_id in(1,7)");
//get admins from db
$ntf = '';
foreach($ul as $usr){
$headers = 'MIME-Version: 1.0 '." \r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . " \r\n";
$headers .= 'From: Centinelas <centinelas#serviciochevrolet.com.ec>' . " \r\n";
$body = "mail content";
$ntf .= "'".$usr['email']."'".', ';
}
$ntf = substr_replace($ntf ,"",-2);
$ml = mail($ntf,'Nuevo Caso en Centinelas Chevrolet',$body,$headers,'- fcentinelas#serviciochevrolet.com.ec');
return('email where sent to :<br/>'.$ntf);
Try sending an email to one person, like yourself or the sender then using the Cc to send to the rest.
$ul = $this->q2ar("SELECT * FROM usr WHERE role_id in(1,7)");
foreach($ul as $usr){
$ntf[] = $usr['email'];
}
$headers = 'MIME-Version: 1.0 '." \r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . " \r\n";
$headers .= 'From: Centinelas <centinelas#serviciochevrolet.com.ec>' . " \r\n";
$headers .= 'Cc: '.join($nft,",") . " \r\n";
$body = "mail content";
$ml = mail('centinelas#serviciochevrolet.com.ec','Nuevo Caso en Centinelas Chevrolet',$body,$headers,'- fcentinelas#serviciochevrolet.com.ec');
return('email where sent to :<br/>'.join($nft,","));
The whole use the Cc: string.
foreach($ul as $usr){
$ntf .= (($ntf=="")?"":", ")."'".$usr['email']."'";
}
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Centinelas <centinelas#serviciochevrolet.com.ec>' . "\r\n";
$headers .= 'From: Centinelas <centinelas#serviciochevrolet.com.ec>' . "\r\n";
$headers .= 'Cc: '.$ntf.'' . "\r\n";
you have to add $ntf "CC:" to the HEADERS (for clarity it is often ok to send the mail to the sender)
I have a site in PHP.In this when I send the invitation to people it takes the from address as mysitename#servername.Instead of this I want o display the Mysitename
.How can I do.I have the code shown below.
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To:'. $value . "\r\n";
$headers .= 'From:Mysitename'."\r\n";
How can I show like in users email's from address is Mysitename?
Thanks in advance?
$headers .= 'From: Mysitename <mysitename.com>' . "\r\n";
http://php.net/manual/en/function.mail.php
Maybe something along the lines of:
$headers .= 'From: Mysitename <owner#mysitename.com>' . "\r\n";
You need 'From' to be proper email address.