, OP. , W7 ( Ultimate) SMTP- ( , Vista 64 Ultimate , , XP), , .
, IIS7 IIS7 Express:
$smtpserver = 'host.domain.tld';
$port = 25;
$from = 'mailbox@domain.tld';
$replyto = $from;
$headers = 'From: ' . $from . "\r\n" . 'Reply-To: ' . $replyto . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$to = 'mailbox@domain.tld';
$subject = 'Test Message';
ini_set('SMTP', $smtpserver);
ini_set('smtp_port', $port);
$message = wordwrap("Hello World!", 70);
$success = mail($to, $subject, $message, $headers);
( TLS/SSL), , PHP:
ini_set('username', 'yourusername');
ini_set('password', 'yourpwd');
TLS/SSL , GMail, Sourceforge xpm4 . GMail ( , ):
error_reporting(E_ALL);
define('DISPLAY_XPM4_ERRORS', true);
require_once '../MAIL.php';
$m = new MAIL;
$m->From('username@gmail.com');
$m->AddTo('client@destination.net');
$m->Subject('Hello World!');
$m->Html('<b>HTML</b> <u>message</u>.');
$c = $m->Connect('smtp.gmail.com', 465, 'username@gmail.com', 'password', 'tls', 10,
'localhost', null, 'plain')
or die(print_r($m->Result));
echo $m->Send($c) ? 'Mail sent !' : 'Error !';
$m->Disconnect();
IIS7 Express ( , ). FastCGI PHP OpenSSL Extension. HTML- . xpm4 ( , ):
error_reporting(E_ALL);
define('DISPLAY_XPM4_ERRORS', true);
require_once '../SMTP.php';
$f = 'username@gmail.com';
$t = 'client@destination.net';
$p = 'password';
$m = 'From: '.$f."\r\n".
'To: '.$t."\r\n".
'Subject: test'."\r\n".
'Content-Type: text/plain'."\r\n\r\n".
'Text message.';
$c = SMTP::connect('smtp.gmail.com', 465, $f, $p, 'tls', 10) or die(print_r($_RESULT));
$s = SMTP::send($c, array($t), $m, $f);
if ($s) echo 'Sent !';
else print_r($_RESULT);
SMTP::disconnect($c);
GMail , IIS7 .