您好,欢迎访问一九零五行业门户网

PHPMailer:Featured email transfer class for PHP_PHP教程

php(做为现在的主流开发语言)mailer:featured email transfer class for php(做为现在的主流开发语言)
php(做为现在的主流开发语言)mailer 是一个很有用的 php(做为现在的主流开发语言) 发送邮件的类。它支持使用 smtp 服务器发送邮件,同时支持 sendmail, qmail, postfix, imail, exchange, mercury, courier 等邮件服务器。smtp服务器的话还支持验证,多smtp发送(不过不太清楚有什么用).邮件发送可以包括多个to, cc, bcc and reply-to,支持text和html两种邮件格式,可以自动换行,支持各种格式的附件及图片,自定义邮件头等基本的邮件功能。
   由于 php(做为现在的主流开发语言) 中只包含了一个 mail 函数,所以 php(做为现在的主流开发语言)mailer 是对其很大的增强,相信是可以满足很多人的需求的,呵呵。其主要包括两个类文件:用于实现发送邮件功能的 class.php(做为现在的主流开发语言)mailer.php(做为现在的主流开发语言) 和 smtp 实现的 class.smtp.php(做为现在的主流开发语言) 。然后还有可以实现多种错误输出的文件,以及很详细的文档。软件发布遵循 lgpl 协议。
使用也很简单,看下面的例子就明白了:
require(class.php(做为现在的主流开发语言)mailer.php(做为现在的主流开发语言));
$mail = new php(做为现在的主流开发语言)mailer();
$mail->issmtp(); // send via smtp
$mail->host = smtp1.site.com;smtp2.site.com; // smtp servers
$mail->smtpauth = true; // turn on smtp authentication
$mail->username = jswan; // smtp username
$mail->password = secret; // smtp password
www.knowsky.com
$mail->from = from@email.com;
$mail->fromname = mailer;
$mail->addaddress(josh@site.com,josh adams);
$mail->addaddress(ellen@site.com); // optional name
$mail->addreplyto(info@site.com,information);
$mail->wordwrap = 50; // set word wrap
$mail->addattachment(/var/tmp/file.tar.gz); // attachment
$mail->addattachment(/tmp/image.jpg, new.jpg);
$mail->ishtml(true); // send as html
$mail->subject = here is the subject;
$mail->body = this is the html body;
$mail->altbody = this is the text-only body;
if(!$mail->send())
{
echo message was not sent
;
echo mailer error: . $mail->errorinfo;
exit;
}
echo message has been sent;
详见php(做为现在的主流开发语言)mailer的主页:http://php(做为现在的主流开发语言)mailer.sourceforge.net/
http://www.bkjia.com/phpjc/508719.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/508719.htmltecharticlephp (做为现在的主流开发语言) mailer:featured email transfer class for php (做为现在的主流开发语言) php (做为现在的主流开发语言) mailer 是一个很有...
其它类似信息

推荐信息