Email not working SMTP Relay Gmail

I’m installing on Ubuntu 20.4 with Docker. So far so good. I’ve managed to install it properly and I can log in to my account with no problems. The only problem is that I cannot send emails.
I would like to connect to our SMTP Relay server of our gmail domain and receive the emails from ‘passbolt@mydoimain.com’. In our organitzation, we have no authentication and we authorize connections with a IP whitelist.

When i run ./bin/cake passbolt send_test_email --recipient=youremail@domain.com i get:


     ____                  __          ____  
    / __ \____  _____ ____/ /_  ____  / / /_ 
   / /_/ / __ `/ ___/ ___/ __ \/ __ \/ / __/ 
  / ____/ /_/ (__  |__  ) /_/ / /_/ / / /    
 /_/    \__,_/____/____/_.___/\____/_/\__/   

 Open source password manager for teams
---------------------------------------------------------------
 Debug email shell
---------------------------------------------------------------

Email configuration
---------------------------------------------------------------
Host: smtp-relay.gmail.com
Port: 587
Username: 
Password: *********
TLS: false

Sending email from: passbolt@mydomain.com
Sending email to: myuser@mydomain.com
---------------------------------------------------------------

Trace
[220] smtp-relay.gmail.com ESMTP y15sm33283ljc.40 - gsmtp

A test email could not be sent.
Error: SMTP server did not accept the connection.
PHP Warning:  fwrite(): supplied resource is not a valid stream resource in /var/www/passbolt/vendor/cakephp/cakephp/src/Console/ConsoleOutput.php on line 255
PHP Warning:  fwrite(): supplied resource is not a valid stream resource in /var/www/passbolt/vendor/cakephp/cakephp/src/Console/ConsoleOutput.php on line 255

And my passbolt.env looks like this:

# Email
EMAIL_TRANSPORT_DEFAULT_HOST=smtp-relay.gmail.com
EMAIL_TRANSPORT_DEFAULT_PORT=25
#EMAIL_TRANSPORT_DEFAULT_USERNAME=''
#EMAIL_TRANSPORT_DEFAULT_PASSWORD=''
EMAIL_DEFAULT_FROM=passbolt@mydomain.com
#EMAIL_TRANSPORT_DEFAULT_TLS=null

We don’t use TLS neither SMTP authentication on our SMTP-Relay server.
I tried to debug using telnet and I could send emails to any email address on my domain.
Anyone knows how to configure it properly?

Thank you so much!

Hi @csbertran, welcome to the forum!

I noticed on your trace:

Email configuration
---------------------------------------------------------------
Host: smtp-relay.gmail.com
Port: 587

Port 587 is a TLS port I think the relay is using port 25 or 2525 (not sure). Can you confirm the env variable EMAIL_TRANSPORT_DEFAULT_PORT is using the expected port (25) before executing the email testing command?

Something like env |grep EMAIL_TRANSPORT_DEFAULT_PORT

1 Like

Same issue even I change the port to 25. (I checked and relay use port 25)


     ____                  __          ____  
    / __ \____  _____ ____/ /_  ____  / / /_ 
   / /_/ / __ `/ ___/ ___/ __ \/ __ \/ / __/ 
  / ____/ /_/ (__  |__  ) /_/ / /_/ / / /    
 /_/    \__,_/____/____/_.___/\____/_/\__/   

 Open source password manager for teams
---------------------------------------------------------------
 Debug email shell
---------------------------------------------------------------

Email configuration
---------------------------------------------------------------
Host: smtp-relay.gmail.com
Port: 25
Username: 
Password: *********
TLS: false

Sending email from: passbolt@mydomain.com
Sending email to: myuser@mydomain.com
---------------------------------------------------------------

Trace
[220] smtp-relay.gmail.com ESMTP m5sm357213wrv.21 - gsmtp

A test email could not be sent.
Error: SMTP server did not accept the connection.
PHP Warning:  fwrite(): supplied resource is not a valid stream resource in /var/www/passbolt/vendor/cakephp/cakephp/src/Console/ConsoleOutput.php on line 255
PHP Warning:  fwrite(): supplied resource is not a valid stream resource in /var/www/passbolt/vendor/cakephp/cakephp/src/Console/ConsoleOutput.php on line 255

I haven’t setup the smtp relay myself but apparently there are some configurations according with https://support.google.com/a/answer/2956491?hl=en

Have you configured the smtp relay to not use TLS and whitelisted a range of ip addresses? Otherwise it looks like you should use EMAIL_TRANSPORT_DEFAULT_TLS=true, point to port 587 and use credentials such as username and password.

1 Like

Yes, my IP is whitelisted and I can send email with telnet using port 25.

root@e25057e20791:/var/www/passbolt# telnet smtp-relay.gmail.com 25
Trying 74.125.193.28...
Connected to smtp-relay.gmail.com.
Escape character is '^]'.
220 smtp-relay.gmail.com ESMTP d18sm357648wrw.11 - gsmtp
HELO mydomainname.com
250 smtp-relay.gmail.com at your service
MAIL FROM: <passbolt@mydomain.com>
250 2.1.0 OK d18sm357648wrw.11 - gsmtp
RCPT TO: <myuser@mydomain.com>        
250 2.1.5 OK d18sm357648wrw.11 - gsmtp
DATA
354  Go ahead d18sm357648wrw.11 - gsmtp
test 
.
250 2.0.0 OK  1605525972 d18sm357648wrw.11 - gsmtp
QUIT
221 2.0.0 closing connection d18sm357648wrw.11 - gsmtp
Connection closed by foreign host.

Maybe Passbolt email sender forces to use credentials (even they are empty) and thats why my smtp relay server is rejecting the connections?

I have no idea of what could be wrong…

Is there a way to flag this as a bug to see if the developers can fix it?
I’d really want to send emails not having to authenticate in the SMTP Server.

I’ll give it a shot and see if I can reproduce your issue with a relay.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.