Magento2默认使用PHP的mail()函数发送邮件, 但是常常发送邮件失败, 所以需要开发或者使用第三方插件或模块, Github上有好心人已经开发好了,拿来使用, 连接地址如下:
https://github.com/magepal/magento2-gmailsmtpapp
本地下载 : magento2-gmailsmtpapp-master
简单操作步骤如下:
1 – Installation Gmail Smtp App
Manual Installation
Install Gmail Smtp App for Magento2
- Download the extension
- Unzip the file
- Create a folder {Magento root}/app/code/MagePal/GmailSmtpApp
- Copy the content from the unzip folder
- Flush cache
2 – Enable Gmail Smtp App
php -f bin/magento module:enable --clear-static-content MagePal_GmailSmtpApp
php -f bin/magento setup:upgrade
php -f bin/magento setup:static-content:deploy
php -f bin/magento cache:flush
3 – Config Gmail Smtp App
Log into your Magento Admin, then goto Stores -> Configuration -> Advanced -> System -> Gmail/Google Apps SMTP Pro and enter your email credentials
如果收不到邮件, 应该是Gmail邮箱设置问题, 通过如下图设置Allow less secure apps:ON即可