[IMP] mail: make connection test attempt to send an email
The "connection test" was only attempting to establish a socket to the SMTP server and then trying to login, if credentials were setup. This would catch basic config errors but would fail to detect setups were the SMTP server would forbid relaying, because of missing credentials, missing STARTSSL mode, and other more complex cases. By actually beginning a real SMTP session and sending the MAIL FROM, RCPT TO and DATA command, we make sure that the server appeas willing to relay emails from the current user address to an arbitrary recipient address. Then we close the session before actually sending the message. In order to have a valid destination domain with a valid MX server, we use an odoo.com recipient address for the test, which should prove that the destination server will relay to arbitrary addresses (unless the destination server is an Odoo.com MX server ;-))
Please register or sign in to comment