note 102282 deleted from function.mail by tomsommer
| From: | tomsommer@php.net | Date: | Tue, 07 Feb 2012 13:20:16 +0000 |
| Subject: | note 102282 deleted from function.mail by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-185892@lists.php.net to get a copy of this message | ||
Note Submitter: dave dot kelly at dawkco dot com
----
On Windows, with the following entries in php.ini, the script below that works fine.
[mail function]
; For Win32 only.
SMTP = "my.mailserver.dom"
smtp_port = 25
<?php
$to = '"To Display Name" <rcpt@rcpt.dom>';
$subject = 'PHP mail test';
$message = 'This message was sent via PHP!' . PHP_EOL .
'It should work ... and it does.' . PHP_EOL . PHP_EOL .
'From Display Name' . PHP_EOL;
$headers = 'From: "From Display Name" <sender@sender.dom>' . PHP_EOL .
'Cc: "CC Display Name" <copied@copied.dom>' . PHP_EOL .
'X-Mailer: PHP-' . phpversion() . PHP_EOL;
if (mail($to, $subject, $message, $headers)) {
echo 'mail() Success!' . "<br />\n";
}
else {
echo 'mail() Failure!' . "<br />\n";
}
?>