在php里从本地通过msmtp发送邮件
参看http://www.absolutelytech.com/2010/07/18/howto-send-emailsusing-mail-function-from-localhost-in-php-through-msmtp-using-gmail-account-on-linux/?的步骤:
?
?
?
?
Msmtp is highly configurable and you can easily configure it to work with any smtp server. If you wish to use any other service with msmtp, you may?read its manual?and configure it.
Proceed to next step only if you have successfully configured and are able to send a test message.
if ( mail ( 'yourusername@gmail.com', 'Test mail from localhost', 'Working Fine.' ) );echo 'Mail sent';elseecho 'Error. Please check error log.';
Replace the yourusername@gmail.com with your own username, save it into a php file along with php delimeters in your virtual host root folder and execute it through the browser. You should receive a mail.
跟上述步骤大同小异。
msmtp在ubuntu下apt-get install msmtp就可以安装, 安装完后, msmtp --ver 查看:
......
?
System configuration file name: /etc/msmtprc
User configuration file name: /root/.msmtprc
显然要保证有/etc/msmtprc文件并要设置好它的配置内容。我的/etc/msmtprc内容如下:# Set default values for all following accounts.defaults?
?