php mail() additional_headers
I can't seem to send any mail using PHP's mail() function whenever I specify the addtional_headers parameter.
<?php
mail('email@ema开发者_如何学JAVAil.com', 'subject', 'message here');
?>
Works fine, but
<?php
$headers = 'MIME-Version: 1.0' . PHP_EOL;
$headers .= 'Content-type: text/html; charset=iso-8859-1' . PHP_EOL;
$headers .= 'From: Me <me@email.com>' . PHP_EOL;
mail('email@email.com', 'subject', '<h1>message</h1>', $headers);
?>
Doesn't deliver any messages at all.
Are there any reasons why this might be occurring?
I can guarantee that your code works fine as-is
as I've tested the actual code you provided and got the email sent to my specified email address - I see it in my inbox with a big message
with <h1>
. I tested it in a server that's capable of sending an email. Your issue may be your server not letting you or if it's a localhost you may need to set it up with a SMTP server- if it is indeed sending, worth a try to check your spam folder ;p
It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination.
That was from http://php.net/manual/en/function.mail.php
Do you have a local server (or a remote on if you have configured it to do so) that is capable of sending emails? I know that localhost servers might not have the capability to actually deliver the email, only accepting queues.
精彩评论