保存,重启apache.
然后借用readme里的一个例子,稍微改一下就可以用了,由于只做最简单的测试,很多东西我注释掉了。
send.php
复制代码 代码如下:
issmtp(); // set mailer to use smtp
$mail->host = mail.songzi.org; // specify main and backup server
$mail->smtpauth = true; // turn on smtp authentication
$mail->username = phpmailer@songzi.org; // smtp username
$mail->password = ******; // smtp password
$mail->from = phpmailer@songzi.org;
$mail->fromname = songzi;
$mail->addaddress($address, );
//$mail->addaddress(); // name is optional
//$mail->addreplyto(, );
//$mail->wordwrap = 50; // set word wrap to 50 characters
//$mail->addattachment(/var/tmp/file.tar.gz); // add attachments
//$mail->addattachment(/tmp/image.jpg, new.jpg); // optional name
//$mail->ishtml(true); // set email format to html
$mail->subject = phpmailer测试邮件;
$mail->body = hello,这是松子的测试邮件;
$mail->altbody = this is the body in plain text for non-html mail clients;
if(!$mail->send())
{
echo message could not be sent. ;
echo mailer error: . $mail->errorinfo;
exit;
}
echo message has been sent;
?>
test.php
复制代码 代码如下:
phpmailer unit test
请你输入收信的邮箱地址:
邮箱地址:
http://www.bkjia.com/phpjc/319747.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/319747.htmltecharticle打开你电脑里的php.ini文件,找到如下位置,添加红线部分的内容,路径就是你phpmailer存放的位置: 保存,重启apache. 然后借用readme里的一个...
