鉴于5.7 laravel应用程序,我使用它们/ said / laravel-mail-preview插件来测试使用snowfire / beautymail模板发送的电子邮件 为此,在我的本地项目的.env中,我可以选择:
MAIL_DRIVER=preview
# MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
可以正常工作的并复制到本地系统生成的电子邮件的“ / storage / email-previews”子目录中。
但是转到我的服务器应用程序(数字海洋下的ubuntu 18)时,我遇到了问题,即电子邮件已发送而收件人没有收到。 在我的服务器上,我已经安装了ssmtp并在文件/etc/ssmtp/ssmtp.conf中添加了我的gmail帐户的信用信息,并在我发送测试电子邮件时 带有邮件($ to,$ subject,$ message,$ headers)的函数接收者可以正常接收这些电子邮件
但是为什么我没有收到带有snowfire / beautymail模板的女巫电子邮件?
在我的服务器应用程序的.env中:
MAIL_DRIVER=smtp
# MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=gmailnick@gmail.com # the same parameters I have in /etc/ssmtp/ssmtp.conf
MAIL_PASSWORD=XXXXXXXXXXXXXXXX # my gmail factor authentication password
MAIL_ENCRYPTION=null
我在日志中看到
# grep -riI ssmtp /var/log
/var/log/syslog.1:Nov 5 23:34:06 nsn-do-lamp sSMTP[3432]: Sent mail for root@smtp.gmail.com:587 (221 2.0.0 closing connection w18-v6sm13037750wrn.66 - gsmtp) uid=0 username=root outbytes=860
/var/log/syslog.1:Nov 6 00:34:06 nsn-do-lamp sSMTP[4242]: Creating SSL connection to host
/var/log/syslog.1:Nov 6 00:34:06 nsn-do-lamp sSMTP[4242]: SSL connection using ECDHE_RSA_CHACHA20_POLY1305
/var/log/syslog.1:Nov 6 00:34:08 nsn-do-lamp sSMTP[4242]: Sent mail for root@smtp.gmail.com:587 (221 2.0.0 closing connection b71-v6sm476787wma.13 - gsmtp) uid=0 username=root outbytes=860
/var/log/syslog.1:Nov 6 01:34:07 nsn-do-lamp sSMTP[5342]: Creating SSL connection to host
/var/log/syslog.1:Nov 6 01:34:07 nsn-do-lamp sSMTP[5342]: SSL connection using ECDHE_RSA_CHACHA20_POLY1305
/var/log/syslog.1:Nov 6 01:34:09 nsn-do-lamp sSMTP[5342]: Sent mail for root@smtp.gmail.com:587 (221 2.0.0 closing connection c24-v6sm77924472wre.44 - gsmtp) uid=0 username=root outbytes=860
/var/log/syslog.1:Nov 6 02:34:07 nsn-do-lamp sSMTP[6155]: Creating SSL connection to host
/var/log/syslog.1:Nov 6 02:34:07 nsn-do-lamp sSMTP[6155]: SSL connection using ECDHE_RSA_CHACHA20_POLY1305
/var/log/syslog.1:Nov 6 02:34:08 nsn-do-lamp sSMTP[6155]: Sent mail for root@smtp.gmail.com:587 (221 2.0.0 closing connection m13-v6sm6126322wrw.14 - gsmtp) uid=0 username=root outbytes=860
/var/log/syslog.1:Nov 6 03:34:07 nsn-do-lamp sSMTP[7181]: Creating SSL connection to host
/var/log/syslog.1:Nov 6 03:34:08 nsn-do-lamp sSMTP[7181]: SSL connection using ECDHE_RSA_CHACHA20_POLY1305
/var/log/syslog.1:Nov 6 03:34:09 nsn-do-lamp sSMTP[7181]: Sent mail for root@smtp.gmail.com:587 (221 2.0.0 closing connection t13-v6sm26521034wrn.22 - gsmtp) uid=0 username=root outbytes=860
/var/log/syslog.1:Nov 6 04:34:04 nsn-do-lamp sSMTP[7905]: Creating SSL connection to host
/var/log/syslog.1:Nov 6 04:34:04 nsn-do-lamp sSMTP[7905]: SSL connection using ECDHE_RSA_CHACHA20_POLY1305
/var/log/syslog.1:Nov 6 04:34:06 nsn-do-lamp sSMTP[7905]: Sent mail for root@smtp.gmail.com:587 (221 2.0.0 closing connection v11-v6sm12069528wrt.40 - gsmtp) uid=0 username=root outbytes=860
/var/log/syslog.1:Nov 6 05:34:05 nsn-do-lamp sSMTP[8799]: Creating SSL connection to host
/var/log/syslog.1:Nov 6 05:34:05 nsn-do-lamp sSMTP[8799]: SSL connection using ECDHE_RSA_CHACHA20_POLY1305
/var/log/syslog.1:Nov 6 05:34:07 nsn-do-lamp sSMTP[8799]: Sent mail for root@smtp.gmail.com:587 (221 2.0.0 closing connection g16-v6sm20220322wrr.38 - gsmtp) uid=0 username=root outbytes=860
我在服务器上设置了cron,上面的消息看起来像是该cron发送电子邮件...
是否发布了服务器的.env文件? 有什么问题吗?
已修改的块#2: 我修改了我的应用程序的.env:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=gmailnick@gmail.com # the same parameters I have in /etc/ssmtp/ssmtp.conf
MAIL_PASSWORD=XXXXXXXXXXXXXXXX # my gmail factor authentication password
MAIL_ENCRYPTION=null
并清除了缓存 但是发送电子邮件时出现错误:
Expected response code 250 but got code "530", with message "530 5.7.0 Must issue a STARTTLS command first. r1-v6sm13862441wrt.59 - gsmtp "
怎么了?
谢谢!