0

I got a code like this:

$headers = '';
//$headers .= 'Reply-To: "site\'s name" <[email protected]>'."\r\n";
//$headers .= 'From: "site\'s name" <[email protected]>'."\r\n";
$headers .= 'MIME-Version: 1.0'."\r\n";
$headers .= 'Content-type: text/html; charset=utf-8'."\r\n";

mail($_POST['email'], stripslashes($result['title']), $message, $headers);

As long as those two lines are commented out, it sends emails correctly. Otherwise - it just doesn't. Without giving any error or even notice. It worked (uncommented code) until yesterday and now it stopped. Any ideas, why would it happen? I cannot use Swift or anything like that, because it's not my project.

Edit: incorrect quoting, but that wasn't the problem. Edit: damn, it was just server admins, they blocked all mails with headers from non-existing accounts. I just had to create such mailbox, and i started working back again...

1
  • 1
    Taken From PHP.net "If messages are not received, try using a LF (\n) only. Some Unix mail transfer agents (most notably » qmail) replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with » RFC 2822." Commented Jun 10, 2014 at 9:12

2 Answers 2

2

You have an error on site's name try with correct quoting

$headers .= 'Reply-To: "site\'s name" <[email protected]>'."\r\n";
$headers .= 'From: "site\'s name" <[email protected]>'."\r\n";
Sign up to request clarification or add additional context in comments.

2 Comments

It's not that :( The real site's name has no quotes, it's only here where I messed it up.
can you paste an example
0

You can add header as the code below. Remove unwanted single quotes and double quotes. Just simple write as below.

$headers = "From: site name <[email protected]> \r\n";
$headers .= "Reply-To: site\'s name <[email protected]> \r\n";
$headers .= "MIME-Version: 1.0\r\n";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.