Failed to send mail. Unable to send test mail

DOLIBARR ENVIRONMENT

I was trying to set up a gmail account for email and it doesn’t seem to work. It’s giving error messages.
I have turned on access to less secure apps in gmail.
I am able to use smtp successfully outside dolibarr.
Below are the errors.

Swift Mailer socket library
Failed to send mail (sender=SuperAdmin dolibarrsys@gmail.com, receiver=dolibarrsys@gmail.com)
Unable to connect with TLS encryption

PHP mail function
Server is not available at address localhost on port 25 - Error 10061 - No connection could be made because the target machine actively refused it.

SMTP/SMTPS socket library
Server is not available at address localhost on port 587 - Error 10061 - No connection could be made because the target machine actively refused it.

Hi,

This is not normal, it should be smtp.google.com

could you print screen the configuration ?

https://wiki.dolibarr.org/index.php?title=Setup_EMails#Gmail_.28with_login.2Fpass_or_login.2Fpass_of_application.29

1 Like

All settings are as per the manual.

Hi bro!
I saw the setting is fine. But the sender and receiver are same email address. Maybe smtp google refused it. Can you try again with different receiver email?

1 Like

No I tried with other receiver addresses too

Is your website secured with SSL (https)?

1 Like

No, it is not. Is it necessary for sending mails? Mine is a local server.

Sure. You need to configure ssl connection to smtp gmail.

1 Like

About that, I’ve been trying to add a self signed asl certificate for so long. Not seem to be working.

I don’t think you can use self signed cer when contacting to smtp google. Your cert need to be verified from trusted CA. In that case, you can try with smtp mail server has less secure.

1 Like

Servus sac!
I’m not experienced with coupling Dolibarr and gmail, but my configuration
has “TLS (STARTTLS) encryption” activated instead of “TLS (SSL) encryption” in your case.
Furthermore my SMTP/SMTPS Port is set to 587 which refers to the encrypted version of SMTPSecure.
This is of course in accordance with my personal webspace and email hoster, so google may demand other settings.
Otherwise I have nearly the same environment as you have, except that I’m running my local Dolibarr on Linux.
And there’s no HTTPSecure required, so no need for certificates with the local installation.

I hope you’ll succeed.
Hans

1 Like

I tried TLS but still there is error,
Error [132]: STARTTLS connection failed. Error [121]: Couldn’t get mail server response codes Error [120]: Ran into problems sending Mail. Response:

You might want to have a look at this thread:

1 Like

I did exactly as said there and yet I get the error message. I also tried using an outlook account to check if it is a Gmail specific problem. But I faced the same error in outlook too.

DId you manage to get this right?

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 .

To do so, first head over to https://accounts.google.com/ → Security → Enable Less Secure Apps

Enabling access for “less secure apps” means that the client/app doesn’t use OAuth 2.0 . OAuth 2.0 is the industry-standard protocol for authorization. When you sign in with OAuth 2.0, you sign in to Google’s system directly. In OAuth 2.0 , you authenticate directly to Gmail with your credentials and authorize an app to do certain things. The third-party app only sees an authorization token provided by Google as proof that you authenticated correctly and agreed to authorize that app.

If I am not mistaken, the feature “less secure apps” (i.e. using your regular password for external logins) has been removed by Google recently. But there is still an alternative option: in your account you can go to → Security and from there to “App passwords”. There you can assign a specific password to log in from an external application. Just make sure you use this password, when you login from this app.

I looked and looked for the App passwords, but I did not see it until I enabled 2-factor, because google also says:

" Sign in with app passwords

Tip: App passwords aren’t recommended and are unnecessary in most cases. To help keep your account secure, use “Sign in with Google” to connect apps to your Google Account.

An app password is a 16-digit passcode that gives a less secure app or device permission to access your Google Account. App passwords can only be used with accounts that have [2-Step Verification](Turn on 2-Step Verification - Computer - Google Account Help) turned on."

I also had to use this method to enable app passwords for our organisation account (text copied to preserve it if the link disappears).

https://www.reddit.com/r/gsuite/comments/11zlrnj/app_passwords_no_longer_available/

calvss

May 23, 2013
Yes I was able to create app passwords less than a month ago. This seems like a recent issue.

I am able to create passwords by opening https://myaccount.google.com/apppasswords but the option is not present in https://myaccount.google.com/security

Is the option to add app passwords still there if you try on your account?

But I (Jon Bendtsen) also used this method described in the link above. (text copied to preserve it if the link disappears).

deione
i was noticing this issue yesterday

try this:

you should be able to get into it from there