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?
Related
I'm trying to figure out how to include custom PHP strings in the message of the PHP mail function.
I have a user registration area on my website. Once a user signs up, I want to email them a success message, such as "Welcome to The site...." I want to include their name in the email, so I would need to pull the value from the field where they entered their name. I will be pulling over field values as well, but this is just an example.
I have:
$name = $conn->real_escape_string($_POST['name']);
$email = 'myemail#gmail.com'
$subject = 'Welcome!'
$message = '<HTML><body><p>Thank you for signing up' .$name. 'We are so glad that you are here</body></html>';
mail($email,$subject,$message);
What am I doing wrong?
add header in your mail like this
$headers = "From: myemail#gmail.com\r\n";
$headers .= "CC: myemail#gmail.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
mail($email, $subject, $message, $headers);
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 am not sure if anyone can help me with this issues but I currently have a php mailing form. everything works great, I am trying to setup Cc options.
code.
$subject = "Name #$name_id test data";
$mailer ='Company <Support#company.com>';
$headers = "From: $mailer \r\n";
$headers .= "Cc: $cc \r\n";
$headers .= "Reply-To: ". strip_tags($mailer) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html><body style="background:#eeeeee">';
mail($emailto, $subject, $message, $headers);
cc var is $cc=$VAR["cc_user"]; which is linked to html form. so here is I enter an email address in the html input form and submit, it works. if I leave blank, email does not send. can anyone help me with this.
Thanks so much.
Fixed..
$emailto= $sql['CUSTOMER_EMAIL'].", ".$VAR["cc_user"];
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.