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