I have installed WAMP Server on my Windows 10 PC and when I try to send emails through a valid SMTP configuration it doesn’t work. The same SMTP configuration works on another LAMP installation and also on a live server.
When I try sending the email through a PrestaShop installation I get following error:
Error: Please check your configuration
Connection could not be established with host smtp.gmail.com [ #0]
And with Magento I get following error:
SMTP Pro Self Test Results
Sending test email to your contact form address: [email protected] from: [email protected]. 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.
As per my understanding, this issue is not dependent on Magento or PrestaShop, it is coming because of the WAMP installation.
Do I have to enable some extension or something for the WAMP installation? Or have I missed something else?
Please help. Already wasted a lot of time investigating and trying solutions from the Web, but nothing seems to be working.
5
Answers
make sure that your –
is enable in php.ini file.
These are possibly causes which prevent you from sending mails via WAMP server.
Since you’re sure that settings have already worked on a server so I assume there nothing to check with PHP.ini
Download the 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
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.
Enable IMAP Access in your GMail’s Settings -> Forwarding and POP/IMAP -> IMAP Access:
Restart WAMP Server.
Create a PHP file and write the following code in it:
Make appropriate changes in $to and $headers variables to set recipient and sender (“From” header) addresses. Save it as “send-mail.php”. (You can save it anywhere or inside any sub-folder in “C:wampwww”.)
Open this file in browser, it MUST work now
You can use PHP Mailer or Download php mailer with example from here. Once you setup the phpmailer with your project use following code to send mail using gmail SMTP :
Include above files in your project or PHP file which you use to send email and then :
Sometimes its easier not to rely on your own smtp server. (firewalls everywhere)
You can experiment with some other online mail delivery services than gmail, like mailgun or sendgrid.