Jump to content

[UPDATED-2024] [SOLVED] [VIDEO] How to set up Gmail SMTP in Prestashop? How to test emails on local host development server on PrestaShop?


Ali Samie

Recommended Posts

--------------------------------------------
UPDATE: It won't work after Sep 2024

This method won't work at the end of this September. Why? Check these pages:
https://support.google.com/accounts/answer/6010255
https://workspaceupdates.googleblog.com/2023/09/winding-down-google-sync-and-less-secure-apps-support.html

Alternative? papercut from ChangemakerStudios and docker

If you are using docker for your development environment, you are my good friend and I like you, otherwise, I have no idea what to do. Find your way. I promise with docker it's gonna be too easy that you can't believe it.

  1. Add `papercut` as a new service to your `docker-compose.yml` file.
    # Other configurations
    # ...
    # ...
    # ...
    
    services:
      #other services
      # ...
      # ...
      # ...
      papercut:
        image: changemakerstudiosus/papercut-smtp:latest
        ports:
          - 10300:80 # choose any port you like, for me `localhost:10300` would be the port to access the papercut web application
          - 25:25
  2. Run or restart your containers to have the new service added to the same network.
  3. Setup SMTP configuration in Prestashop backoffice like this image
    1. Set the method as "Set my own SMTP ...".
    2. Set the SMTP server to "papercut" which is the name of the service or container, and it's accessible with that name in the network of containers.
    3. Leave the email domain, username, and password fields empty.
    4. Set encryption to none and the port to 25. This number comes from the docker-compose file, you can change it if you need.
    5. image.thumb.png.9155fd9fe65020039b7061175b4171a4.png
  4. Now try sending an email by triggers like account creation order status change or use of the Mail::send() method, here's a demo:
    1.  Sent emails list
      image.thumb.png.453c7465faa551fe3c278407be7909d1.png
    2. Preview an email:
      image.thumb.png.e06138921499f5bf719d53e82eeba879.png

Thanks to this amazing repository on Github: https://github.com/ChangemakerStudios/Papercut-SMTP

----------------------------------------------------------------------------

How to test email functions with a Gmail account in Prestashop?

Hi community.

I have seen some questions about the email issues. I want to show you how to set up a Gmail account in Prestashop as your temporary SMTP server, which lets you easily test your email functionality, templates and related stuff.

This is what I went through in a local server and I manged to get it working.

  1. Set up a new Gmail account (if you do not have any).
  2. Sign in to your account.
  3. Open BO of your Prestashop.
  4. Go under this menu "Advanced Parameters > E-mail".
  5. Find the "Email" form.
  6. Fill the form like this:
    1. Send emails to > Select "Customer Service"
    2. Radio Buttons > Select "Set my own SMTP parameters (for advanced users ONLY)"
    3. Email domain name > Let it be blank
    4. SMTP server > "smtp.gmail.com"
    5. SMTP username > Fill it with your gmail for example : [email protected]
    6. SMTP password  > Fill it with the account password (if does not work create an APP password and use that)
    7. Encryption > Select "TLS"
    8. Port > "578"
    9. Radio Buttons > Select "Both"
    10. Log emails > Select "Yes"

After you have saved these, send a test email in the next form with title of "Test your email configuration".

I have added a video for you to follow the steps. It very easy.

I use this method just for testing, like when you want to test the email templates and you do not want to put time on setting up an SMTP server locally. I do not recommend using this in a production shop.

Edited by Ali Samie
Update with new solution (see edit history)
Link to comment
Share on other sites

Just now, juanrojas said:

recently you have been told that it does not work

It works for me. So may be they missed some thing in the set up or there are server issues!

And I have mentioned that this works in my local server. So there it could be useful if a developer is working on email templates.

9 minutes ago, stifler97 said:

This is what I went through in a local server and I manged to get it working.

 

Link to comment
Share on other sites

  • Ali Samie changed the title to [SOLVED] [VIDEO] How to set up Gmail SMTP in Prestashop?
  • 5 weeks later...
4 hours ago, gouna said:

Hi, don't work with a 1.7.8.7 

Hi. Thanks for the report.

Instead of these

On 7/22/2022 at 6:46 AM, stifler97 said:
  • SMTP username > Fill it with your gmail for example : [email protected]
  • SMTP password  > Fill it with the account password (if does not work create an APP password and use that)
  • Encryption > Select "TLS"
  • Port > "578"

I did these:

  1. SMTP username > Fill it with your google account for example if your gmail address is [email protected] you must enter myaccount
  2. SMTP password > Create an APP password in your google account panel and paste it here
  3. Encryption > Select "SSL"
  4. Port > "465"

Test video:

 

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

Hello

I tried all the above methods in my client website indianbasket.pl but I am getting below error. I created app password and tested. My client wants to send email conformation from Gmail only. 

Error: Please check your configuration

Failed to authenticate on SMTP server with username "[email protected]" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials kr12-20020a1709079a0c00b0084d44553af9sm14245369ejc.215 - gsmtp ". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials kr12-20020a1709079a0c00b0084d44553af9sm14245369ejc.215 - gsmtp ". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials kr12-20020a1709079a0c00b0084d44553af9sm14245369ejc.215 - gsmtp ".

Email Config.jpg

Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...
  • 1 month later...

Hello, I am experiencing the same problems, all my customers with Gmail accounts are not receiving their email.

I tried the different configurations, with the password generated by gmail, no results.

should you use your personal password? is it safe?

thanks

beza

 

Link to comment
Share on other sites

Google has changed their configuration

https://support.google.com/mail/thread/109381919/i-am-not-receiving-emails-from-certain-domains?hl=en

The way to accept domains non regisistered is not proven, you can off course let Google do your mail via Google Business Suite. But Google is not recommended, you will become and depend to or on their services 

Edited by Nickz (see edit history)
Link to comment
Share on other sites

  • 2 months later...
On 7/13/2023 at 8:26 AM, FlamingoFr said:

With my Google workspace account,

I set smpt server to smtp-relay.gmail.com

SSL/465

General password didn't work. I set an App password and it works fine!

Hi, I tested today and again it works
TLS or SSL does not matter
The only thing is that you need to use APP password
And you need to use the right smtp server, I used smtp.gmail.com

Link to comment
Share on other sites

  • 3 months later...

Ali Samien's post is very well explained, I experienced the same problem for the website with an email hosted at gmail, one more thing needs to be added, you need to make sure that the server has the Remote SMTP function activated in order to work. In this case, you must contact the hosting.

Connection could not be established with host smtp.gmail.com :stream_socket_client(): Unable to connect to tcp://smtp.gmail.com:587 (Cannot assign requested address) 

Link to comment
Share on other sites

  • Ali Samie changed the title to [UPDATED-2024] [SOLVED] [VIDEO] How to set up Gmail SMTP in Prestashop? How to test emails on local host development server on PrestaShop?
  • 2 weeks later...

Hi!

Instead of installing / using Papercut SMTP server and bother your head with Google App passwords bla bla bla... which soon will no longer be available... why don't you use Microsoft Visual Studio + Live server instead?!? Live server updates the code as soon as you change it, the way papercut does it.... in my opinion this is the best way you can test your email templates.

All the best!

 

Link to comment
Share on other sites

4 hours ago, ccristian said:

Hi!

Instead of installing / using Papercut SMTP server and bother your head with Google App passwords bla bla bla... which soon will no longer be available... why don't you use Microsoft Visual Studio + Live server instead?!? Live server updates the code as soon as you change it, the way papercut does it.... in my opinion this is the best way you can test your email templates.

All the best!

 

I'm using docker containers as my dev env, so I guess I can't use the live-server feature. Despite that, papercut was really easy to use.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...