我正在nopcommerce的电子商务网站上工作。我想发送邮件,当用户之前已经注册并尝试再次使用相同的电子邮件ID注册时。邮件包含正文内容为“此用户的用户名是一些用户名”。当我编写代码并执行它时,它在本地工作正常。但是当我在服务器中运行它(在IIS服务器中创建一个新网站后),邮件没有被发送。另一件事是我创建的页面,它将显示为“邮件是成功发送“在本地显示。但即使网址相同,它也不会显示在服务器中。任何人都可以向我推荐解决方案。
答案 0 :(得分:1)
此解决方案需要sendmail.exe(一个命令行界面(CLI)可执行文件,它接受来自PHP的电子邮件,连接到SMTP服务器并发送电子邮件)。您不需要按命令使用它,也不要打扰它:-)下载sendmail.zip并按照以下步骤操作:
Create a folder named “sendmail” in “C:\wamp\”.
Extract these 4 files in “sendmail” folder: “sendmail.exe”, “libeay32.dll”, “ssleay32.dll” and “sendmail.ini”.
Open the “sendmail.ini” file and configure it as following
smtp_server=smtp.gmail.com
smtp_port=465
smtp_ssl=ssl
default_domain=localhost
error_logfile=error.log
debug_logfile=debug.log
auth_username=[your_gmail_account_username]@gmail.com
auth_password=[your_gmail_account_password]
pop3_server=
pop3_username=
pop3_password=
force_sender=
force_recipient=
hostname=localhost
You do not need to specify any value for these properties: pop3_server, pop3_username, pop3_password, force_sender, force_recipient. The error_logfile and debug_logfile settings should be kept blank if you have already sent successful email(s) otherwise size of this file will keep increasing. Enable these log file settings if you don’t get able to send email using sendmail.