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.
Related
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
i am using php mail function
$message.='Hi '.$name.', You have been invited to join this, you can do so by following This link, '.$text.'';
$headers = "From: abc#gmail.com" . "\r\n" ."CC: abc#hotmail.com";
$emailTo = $email;
$subject = "Invitation email";
mail($emailTo, $subject, $message, $headers);
it is working fine, but this <a> i am using is either not appended right or not written syntatically correct, the email i get is.
Hi this, You have been invited to join Maggie, you can do so by following
<a
href="http://google.com.pk" class="link"
id="position">this link</a>
, this is a sample email to send.
the tag is written as is, how can i append this <a> into this mail?
You need to specify headers. Take a look.
$message = "Hello, hope you are doing fine.<br>"
. "Please check this:<br>"
. "Anchor text";
$headers = 'MIME-Version: 1.0' . "\r\n"
. 'Content-type: text/html; charset=iso-8859-1' . "\r\n"
. 'From: youremail#yourdomain.com' . "\r\n";
Do use " (double quotes) for message.
Change your headers to or add these
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$header.= "X-Priority: 1\r\n";
Set headers might help :
$headers = "Reply-To: FROM_NAME <FROM_EMAIL>\r\n";
$headers.= "From: FROM_NAME <FROM_EMAIL>\r\n";
$headers.='X-Mailer: PHP/' . phpversion();
$headers.= "X-Priority: 3\r\n";
$headers.= "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
Place this on top:
header("Content-Type: text/html");
The headers shoulds contain the content type...
$header.= "Content-Type: text/html; charset=ISO-8859-1\r\n";
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.
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";
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.