Magento2默认使用PHP的mail()函数发送邮件, 但是常常发送邮件失败, 所以需要开发或者使用第三方插件或模块, Github上有好心人已经开发好了,拿来使用, 连接地址如下:
简单操作步骤如下:
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
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
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即可