Sending mails with Gmail SMTP

Hi,
I’ve spent hard time to send quotes and invoices by email using SMTP method and my gmail account. Finally, it worked out entering “ssl://smtp.gmail.com:465” in the SMTP server adress field.
I beleive this is the only method to make it work with encrypted passwords.
Hope it can help someone !
Romain

1 Like

Hi, i’ve got a possible solution for GMail
but in french
https://www.hostinger.fr/tutoriels/utiliser-serveur-smtp-gmail/

Otherwise, you can use a solution like mailjet.fr to allow you to use a SMTP and to monitor email openings for free for 200 mails / days.
It’s works in english too

Mailgun offers up to 10.000 emails per month for free. Using it for several years now without any problems.

1 Like

Hello,
So, I’ve been having trouble setting up SMTP email config. I’ve tried moving the parameters using mailjet too but I get this error:
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Looking the error logs I get:
EBUG - 2018-11-09 20:33:02 --> Global POST, GET and COOKIE data sanitized
DEBUG - 2018-11-09 20:33:02 --> Mailer MX_Controller Initialized
DEBUG - 2018-11-09 20:33:02 --> Config file loaded: /home/OP/public_html/client/application/config/invoice_plane.php
DEBUG - 2018-11-09 20:33:02 --> Encryption: Auto-configured driver ‘openssl’.
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/settings/models/Mdl_settings.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/settings/models/Mdl_versions.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/controllers/…/modules/layout/controllers/Layout.php
DEBUG - 2018-11-09 20:33:02 --> Layout MX_Controller Initialized
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/invoices/models/Mdl_templates.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/invoices/models/Mdl_invoices.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/email_templates/models/Mdl_email_templates.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/custom_fields/models/Mdl_custom_fields.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/layout/views/alerts.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/email_templates/views/template-tags.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/upload/views/dropzone-invoice-html.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/upload/views/dropzone-invoice-scripts.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/mailer/views/invoice.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/layout/views/includes/head.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/layout/views/includes/navbar.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/layout/views/includes/fullpage-loader.php
DEBUG - 2018-11-09 20:33:02 --> File loaded: /home/OP/public_html/client/application/modules/layout/views/layout.php
DEBUG - 2018-11-09 20:33:02 --> Total execution time: 0.0514
DEBUG - 2018-11-09 20:33:03 --> UTF-8 Support Enabled
DEBUG - 2018-11-09 20:33:03 --> Global POST, GET and COOKIE data sanitized
DEBUG - 2018-11-09 20:33:03 --> Upload MX_Controller Initialized
DEBUG - 2018-11-09 20:33:03 --> Config file loaded: /home/OP/public_html/client/application/config/invoice_plane.php
DEBUG - 2018-11-09 20:33:03 --> Encryption: Auto-configured driver ‘openssl’.
DEBUG - 2018-11-09 20:33:03 --> File loaded: /home/OP/public_html/client/application/modules/settings/models/Mdl_settings.php
DEBUG - 2018-11-09 20:33:03 --> File loaded: /home/OP/public_html/client/application/modules/settings/models/Mdl_versions.php
DEBUG - 2018-11-09 20:33:03 --> File loaded: /home/OP/public_html/client/application/controllers/…/modules/layout/controllers/Layout.php
DEBUG - 2018-11-09 20:33:03 --> Layout MX_Controller Initialized
DEBUG - 2018-11-09 20:33:03 --> File loaded: /home/OP/public_html/client/application/modules/upload/models/Mdl_uploads.php
DEBUG - 2018-11-09 20:33:03 --> Total execution time: 0.0536

Any suggestions ?
Thanks!

Hi,
Could you paste parameters?

Are they like this ?

Hi, they’re Very similar,

Another thing is that my hosting provider enabled SSL (AutoSSL ) for my domain. I’m not sure if that’s causing more trouble. Should I keep it or disable it?

Keep your provider config.

Test with no to the last thing about certificate.

I’ve changed the Verify SMTP field to “No”, still same error:
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

What could it be?

It could be :

  • a bad SMTP username
  • a bad SMTP Password
  • a bad SMTP Port blocked by your provider, test SMTP Port 25 or 587 and if it doesn’t work, test 587, 25 or 465 with TLS

Good luck

1 Like

Look at the begining of this topic. Try “ssl://in-v3[…].com:465” in the SMTP server adress

Sharing my two cents how I solved this when hitting the SMTP connect () failed error. Recently Google has strengthen its security core. Not allowing apps who are not identified to login/authenticate.

  1. Isolating it’s not a code and port blocked issue by service provider, this is done by testing with other smtp accounts. if this works, proceed to item 2.
  2. Use “Less secure app access”. Turn in on at here.
  3. If you feel you are more exposed to vulnerabilities, use 2-step verification. Turn it on here

Few other solutions which I read didn’t work, so save you some time from trying:

  1. Making sure your password do not contain special character
  2. Downgrading your PHP version to 5.0
  3. Upgrading your PHP version to 7.2
1 Like

Try Google Less secure apps configuration

Log in to your Gmail account through a web browser and enable access through less secure apps . Less secure apps can make your account more vulnerable, Google will automatically turn this setting off if it’s not being used. However, bypass this security setting with a configuration tweak within your Google Email Account .

How “more secure apps” help to protect your account?

  • Which level of access you’re giving the client before you connect your Account.
  • Client access only a relevant part of your Account, like your email or calendar.
  • Connect your Google Account to the client without exposing your password.
  • Disconnect your Google Account from the client at any time.
1 Like

Hi,

For anyone that’s still struggling with SMTP Gmail, try this
First you need a gmail account with enabled Less-secure apps and Imap enabled, then you’re all set.
Go to Invoiceplane email setting, select smtp, configure it like so

Server: tls://smtp.gmail.com:587
Sender: (your activated gmail above)
Authentication: Yes
Username: (same as sender)
Password: (your gmail password)
Port: 587
Security: TLS
Verify: No

Save, and try to send email with invoiced attached, hope it works for you too

1 Like

I just tried this and was getting failure to connect to SMTP error.

Also when I switched off 2 factor auth on my Google account and activated Less Secure Apps, its told me that the Less Secure Apps setting is disappearing after May 30, 2022, so I don’t know if using GMail SMTP via InvoicePlane will still be feasible after then?

Does not have anything to do with InvoicePlane nor with SMTP, it btw also works perfectly fine for me - just tested.

But it does have something to do with how Googles SMTP works. Thats the problem here. It the problem would be withing InvoicePlane it would occur on EVERY service thats SMTP based.