require("class.phpmailer.php");
$smtp_server = "121.52.212.84"; // SMTP servers
$smtp_auth = true; // turn on SMTP authentication
$smtp_username = "zjh@castertroy.net"; // SMTP username
$smtp_password = "A119328118a"; // SMTP password
$from = "zjh@castertroy.net";
$to = "jinhui.zhu@live.cn";
$subject = "Test Mail";
// send mail via SMTP
$mail = new PHPMailer();
$image_content_id=
$html_message="
$subject
$subject
Hello ".strtok($to_name," ").",
This message is just to let you know that the MIME E-mail message composing and sending PHP class is working as expected.
Here is an image embedded in a message as a separate part:
".
/*
* This example of embedding images in HTML messages is commented out
* because not all mail programs support this method.
*
* Here is an image embedded directly in the HTML:
*
*/
"Thank you,
$from_name
|
";
$mail->IsSMTP();
$mail->Host = $smtp_server;
$mail->SMTPAuth = $smtp_auth;
$mail->Username = $smtp_username;
$mail->Password = $smtp_password;
//AddEmbeddedImage(var $path, var $cid, var $name, var $encoding, var $type)
$mail->AddEmbeddedImage('mail.jpg', 'png1', 'mail.jpg','base64',"image/jpg");
$mail->From = $from;
$mail->AddAddress($to);
$mail->IsHTML(true); // send as HTML
$mail->Subject = $subject;
$mail->Body = $html_message;
//$mail->AltBody = $html_message;
if(!$mail->Send())
{
echo "Message was not sent ";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>