roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.89k stars 1.64k forks source link

SMTP Error (554): sending to remote adresses (relaying) is not allowed #7387

Closed mcnesium closed 4 years ago

mcnesium commented 4 years ago

I am trying to run Roundcube Webmail 1.4.4 in a Docker environment (see here for Dockerfile etc.) with the identity-smtp plugin, which allows me to also send mail from multiple mail accounts (identities).

Problem: sending mails does only work for recipients whose domain name is also handled by the same SMTP-server that I am trying to send mail to. For any other recipient, the following error message appears:

SMTP Error (554): Failed to add recipient "mail@recipient.tld" (Refused. Sending to remote addresses (relaying) is not allowed.)

I am not sure whether that is a configuration error or a bug within one of the components. For the plugin I already asked here, but no response there. In another non-dockerized setup and Roundcube Webmail 1.3.10 this plugin is included and works very well. So either this is an issue with v1.4.x or a configuration error.

How can I fix this? Any help?


This is a copy of my post in the roundcube forum which sadly does not seem to be very frequented anymore.

alecpl commented 4 years ago

Looks like a config issue. Enable smtp_debug to see more details.

mcnesium commented 4 years ago

Enable smtp_debug to see more details.

How and where do I do that?

So here is the SMTP_DEBUG output seen by adding $config['smtp_debug'] = true; to config.inc.php and then doing docker logs -f while trying to send. First for sending a mail to an account that uses the same SMTP (same domain):

smtp: <7cc5f104> Connecting to tls://schedar.uberspace.de:587...
smtp: <7cc5f104> Recv: 220 schedar.uberspace.de ESMTP
smtp: <7cc5f104> Send: EHLO webmail.mydomain.de
smtp: <7cc5f104> Recv: 250-schedar.uberspace.de
smtp: <7cc5f104> Recv: 250-STARTTLS
smtp: <7cc5f104> Recv: 250-PIPELINING
smtp: <7cc5f104> Recv: 250-8BITMIME
smtp: <7cc5f104> Recv: 250 AUTH LOGIN PLAIN
smtp: <7cc5f104> Send: MAIL FROM:<mail@mydomain.de>
smtp: <7cc5f104> Recv: 250 ok
smtp: <7cc5f104> Send: RCPT TO:<qwer@mydomain.de>
smtp: <7cc5f104> Recv: 250 ok
smtp: <7cc5f104> Send: DATA
smtp: <7cc5f104> Recv: 354 Proceed.
…

And here is the output when sending to some other address on a different mail server:

smtp: <7cc5f104> Connecting to tls://schedar.uberspace.de:587...
smtp: <7cc5f104> Recv: 220 schedar.uberspace.de ESMTP
smtp: <7cc5f104> Send: EHLO webmail.mydomain.de
smtp: <7cc5f104> Recv: 250-schedar.uberspace.de
smtp: <7cc5f104> Recv: 250-STARTTLS
smtp: <7cc5f104> Recv: 250-PIPELINING
smtp: <7cc5f104> Recv: 250-8BITMIME
smtp: <7cc5f104> Recv: 250 AUTH LOGIN PLAIN
smtp: <7cc5f104> Send: MAIL FROM:<mail@mydomain.de>
smtp: <7cc5f104> Recv: 250 ok
smtp: <7cc5f104> Send: RCPT TO:<mail@otherdomain.com>
smtp: <7cc5f104> Recv: 554 Refused. Sending to remote addresses (relaying) is not allowed.
errors: <7cc5f104> PHP Error: Invalid response code received from server (POST /?_task=mail&_unlock=loading1589809230866&_framed=1&_lang=en_US&_action=send)
smtp: <7cc5f104> Send: RSET
smtp: <7cc5f104> Recv: 250 flushed
errors: <7cc5f104> SMTP Error: Failed to add recipient 'mail@otherdomain.com'. Refused. Sending to remote addresses (relaying) is not allowed. (Code: 554) in /var/www/html/program/lib/Roundcube/rcube.php on line 1702 (POST /?_task=mail&_unlock=loading1589809230866&_framed=1&_lang=en_US&_action=send)
smtp: <7cc5f104> Send: QUIT
smtp: <7cc5f104> Recv: 221 schedar.uberspace.de172.21.0.1 - - [18/May/2020:13:40:31 +0000] "POST /?_task=mail&_unlock=loading1589809230866&_framed=1&_lang=en_US HTTP/1.1" 200 956 "https://webmail.mydomain.de/?_task=mail&_action=compose&_id=15772262815ec29043a5049" "Mozilla/5.0 (X11; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0"

Is that output more helpful?

trasherdk commented 4 years ago

This is a server side configuration problem. The mydomain.deis not recognized as a local domain, and not allowed to do stuff on that server. Read the documentation for whatever server you are using. Look for relaying denied.

Long version of RTFM.

mcnesium commented 4 years ago

If this is really a configuration issue with the SMTP server, I wonder why it works with Roundcube v1.3.10 and below

mcnesium commented 4 years ago

I found out that it works, when commenting the encryption of passwords here and putting just $smtpSettings['smtp_pass']; instead of the decrypting here and then re-enter the passwords in the identity settings (passwords are then stored unencrypted to the database!) So there must be something wrong with the password en- or decryption.

I know this third party plugin is not actively maintained by Roundcube devs, but it seems to be abandoned, and so I am looking for help to be able to fix this myself.

Plus, I wonder how else we are supposed to make use of multiple identities feature in Roundcube, if we are not able to send mails through a separate SMTP server for each identity.

Who can help?