XPertMailerPHP發(fā)送郵件函數(shù)庫
你可以利用XPertMailer來發(fā)送MIME類型的郵件如text,HTML,含圖片的HTML頁面,附件等。支持Cc和Bcc功能。
示例代碼:
<?php
define('DISPLAY_XPM4_ERRORS', true); // display XPM4 errors
require_once '/path-to/MAIL.php'; // path to 'MAIL.php' file from XPM4 package
$m = new MAIL; // initialize MAIL class
$m->From('[email protected]'); // set from address
$m->AddTo('[email protected]'); // add to address
$m->Subject('Hello World!'); // set subject
$m->Text('Text message.'); // set text message
// connect to MTA server 'smtp.hostname.net' port '25' with authentication: 'username'/'password'
$c = $m->Connect('smtp.hostname.net', 25, 'username', 'password') or die(print_r($m->Result));
// send mail relay using the '$c' resource connection
echo $m->Send($c) ? 'Mail sent !' : 'Error !';
$m->Disconnect(); // disconnect from server
print_r($m->History); // optional, for debugging
?>
