PEAR Mail.php

我想在服务器上用 Gmail SMTP 代替 sendmail 发送邮件,并不想用 Zend_Mail,只想找一个轻量级的解决方案。

一找就找到 Pear Mail。提示说只要用


pear install Mail

然后在程序里


include_once "Mail.php";

我照着做了,可是提示:

Warning: include_once(Net/SMTP.php): failed to open stream: No such file or directory in mail/Mail/smtp.php on line 348
PHP Warning: include_once(): Failed opening ‘Net/SMTP.php’ for inclusion (include_path=’.:/usr/lib/php’) in mail/Mail/smtp.php on line 348
PHP Fatal error: Class ‘Net_SMTP’ not found inmail/Mail/smtp.php on line 349

原来还需要安装一个依赖包


pear install Net_SMTP

1 comment

  1. 也可以用 pear install –alldeps Mail。

    这样直接装了以下四个依赖包:
    install ok: channel://pear.php.net/Mail-1.2.0
    install ok: channel://pear.php.net/Net_Socket-1.0.14
    install ok: channel://pear.php.net/Auth_SASL-1.0.6
    install ok: channel://pear.php.net/Net_SMTP-1.6.2

Leave a comment

Your email address will not be published. Required fields are marked *