phpmailer的简单使用

<?php
header("content-type:text/plain; charset=utf-8");
error_reporting(E_ALL ^ E_NOTICE);
error_reporting(0);
date_default_timezone_set("PRC");
require_once 'librariy/class.phpmailer.php';
$mail=new PHPMailer();
$address='[email protected]';
$mail->IsSMTP();
$mail->Host='mail.ulucu.com';
$mail->CharSet='utf-8';
$mail->SMTPAuth=true;
$mail->Username='[email protected]';
$mail->Password='******';
$mail->Port=25;
$mail->From='[email protected]';
$mail->FromName='cai';
$mail->AddAddress($address,'上海悠络客');
$mail->IsHTML(true);
$mail->Subject='test';
$body  = $mail->getFile('codeworxtech.html');
$body  = eregi_replace("[\]",'',$body);

$mail->Body=$body;
if(!$mail->Send()){
	echo "邮件发送失败";
	 
}else{
	echo "邮件发送成功";
}
?>
 

你可能感兴趣的:(phpmailer)