Wol*_*ack 3 php email smtp wamp magento
我已在 Windows 10 PC 上安装了 WAMP Server,当我尝试通过有效的 SMTP 配置发送电子邮件时,它不起作用。相同的 SMTP 配置适用于另一个 LAMP 安装以及实时服务器。
当我尝试通过 PrestaShop 安装发送电子邮件时,出现以下错误:
Error: Please check your configuration
Connection could not be established with host smtp.gmail.com [ #0]
Run Code Online (Sandbox Code Playgroud)
使用 Magento 我收到以下错误:
SMTP Pro Self Test Results
Sending test email to your contact form address: xxxxxxx@example.com from: xxx.adsxx@example.com. Unable to send test email.
Exception message was: Could not open socket
Please check the user guide for frequent error messages and their solutions.
Default templates exist.
Email communications are enabled.
Run Code Online (Sandbox Code Playgroud)
据我了解,这个问题不依赖于Magento或PrestaShop,它是由于WAMP安装而出现的。
我是否必须为 WAMP 安装启用某些扩展或其他功能?或者我错过了什么?
请帮忙。已经浪费了大量时间调查和尝试网络上的解决方案,但似乎没有任何效果。
小智 5
下载sendmail.zip
\n\n在 \xe2\x80\x9cC:\\wamp\\\xe2\x80\x9d 中创建名为 \xe2\x80\x9csendmail\xe2\x80\x9d 的文件夹。\n在 \xe2\x80\x9csendmail\xe2 中提取这 4 个文件\x80\x9d 文件夹:\xe2\x80\x9csendmail.exe\xe2\x80\x9d、\xe2\x80\x9clibeay32.dll\xe2\x80\x9d、\xe2\x80\x9cssleay32.dll\xe2\x80\x9d和 \xe2\x80\x9csendmail.ini\xe2\x80\x9d。\n打开 \xe2\x80\x9csendmail.ini\xe2\x80\x9d 文件并按如下所示进行配置
\n\nsmtp_server=smtp.gmail.com\nsmtp_port=465\nsmtp_ssl=ssl\ndefault_domain=localhost\nerror_logfile=error.log\ndebug_logfile=debug.log\nauth_username=[your_gmail_account_username]@gmail.com\nauth_password=[your_gmail_account_password]\npop3_server=\npop3_username=\npop3_password=\nforce_sender=\nforce_recipient=\nhostname=localhost\nRun Code Online (Sandbox Code Playgroud)\n\n您不需要为以下属性指定任何值:pop3_server、pop3_username、pop3_password、force_sender、force_recipient。如果您已经发送成功的电子邮件,则 error_logfile 和 debug_logfile 设置应保留为空,否则该文件的大小将不断增加。如果您无法使用 sendmail 发送电子邮件,请启用这些日志文件设置。
\n\n在 GMail\xe2\x80\x99s 设置 -> 转发和 POP/IMAP -> IMAP 访问中启用 IMAP 访问:
\n\nEnable \xe2\x80\x9cphp_openssl\xe2\x80\x9d and \xe2\x80\x9cphp_sockets\xe2\x80\x9d extensions for PHP compiler:\n\nOpen php.ini from \xe2\x80\x9cC:\\wamp\\bin\\apache\\Apache2.2.17\\bin\xe2\x80\x9d and configure it as following (The php.ini at \xe2\x80\x9cC:\\wamp\\bin\\php\\php5.3.x\xe2\x80\x9d would not work) (You just need to configure the last line in the following code, prefix semicolon (;) against other lines):\nRun Code Online (Sandbox Code Playgroud)\n\n重新启动 WAMP 服务器。\n创建一个 PHP 文件并在其中写入以下代码:
\n\n<?php\n$to = \'recipient@yahoo.com\';\n$subject = \'Testing sendmail.exe\';\n$message = \'Hi, you just received an email using sendmail!\';\n$headers = \'From: [your_gmail_account_username]@gmail.com\' . "\\r\\n" .\n \'MIME-Version: 1.0\' . "\\r\\n" .\n \'Content-type: text/html; charset=utf-8\';\nif(mail($to, $subject, $message, $headers))\n echo "Email sent";\nelse\n echo "Email sending failed";\n?>\nRun Code Online (Sandbox Code Playgroud)\n\n对 $to 和 $headers 变量进行适当的更改以设置收件人和发件人(\xe2\x80\x9cFrom\xe2\x80\x9d 标头)地址。将其保存为 \xe2\x80\x9csend-mail.php\xe2\x80\x9d。(您可以将其保存在 \xe2\x80\x9cC:\\wamp\\www\xe2\x80\x9d 中的任何位置或任何子文件夹内。)\n在浏览器中打开此文件,它现在必须可以工作
\n