I am struggling this BCC.
I have 2 email addresses that I've included in the BCC field, but only the first email in the field gets the message, the second email is ignored.
i don't know what am doing wrong.
my code is below
$EmailListHere = 'mail1#domain.com,mail2#domain.com';
$headers = "From: ".$_POST['from-address']."\nX-Mailer: php\n";
$headers .= "MIME-Version: 1.0\n"; #Define MIME Version
$headers .= "Content-Type: text/html; charset=ISO-8859-1\n"; #Set content type
$headers .= "Bcc: $EmailListHere\n"; #Your BCC Mail List
echo mail(null, $subject=$_POST['subject'], $message=$_POST['html-body'], $headers);
Related
I have a website contact form that sends HTML email with photo attachments as an email to Iphone mail application. I am receiving the following error message on my Iphone:
"This message cannot be displayed because of the way it is formatted. Ask the sender to send it again using a different format or email program. multipart/mixed".
Is this has something to do with email content-type and how to fix it in my PHP code.
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From:".$from_email."\r\n";
$headers .= "From:".$from_email."\r\n";
$headers .= "Reply-To: ".$sender_email."" . "\r\n";
$headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n";
$body = "--$boundary\r\n";
$body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode($message_body));
$sentMail = mail($recipient_email, $subject, $body, $headers);
I'm attempting to reply to an email from a php applicaiton. I use php imap to retrieve emails from the mail server. I now want to reply to those messages. I have the message_id returned from imap_fetch_overview. How do i use these values to reply to the email? I tried In-Reply-To but when i check the email the message shows up as a new message rather than a reply to a message.
$overview = imap_fetch_overview($inbox,$email_number,0);
$headers = "From: <test#domain.co.uk> \r\n";
$headers .= "In-Reply-To: ".$overview[0]->message_id."\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$subject = "testing";
$message = "test message2";
mail( "test2#domain.co.uk", $subject, $message, $headers );
How do i solve?
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 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";
I have this logic
$subject = "something.com Signup -
Please do not reply to this email. It was automatically generated.";
$body = "A new person has signed up to receive something updates:";
$headers = "From: webinquiries#something.com\n";
$headers .= "Reply-To: something#gmail.com\n";
// $headers .= 'Bcc: something#something.com' . "\r\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/plain; charset=ISO-8859-1\n";
mail($email, $subject, $body, $headers);
which seems ok but one thing.... can i set the smtp info like this
server="smtp.something.net",
username="webinquiries#somthing.com",
password="asda.1sda",
port="587"
you can set the server in php.ini, but user\password as php's build in mail does not support authentication. you should look at a third party library (phpmailer) as the php mail() function's very under powered.