Office365 SMTP: "unable to establish SMTP connection"

Skip to first unread message

Alexander Farley

May 24, 2018, 7:57:49 PM5/24/18
Just set up Bugzilla 5.0.4 on Ubuntu 14.04.5 LTS VM hosted inside Windows Server. SMTP email from Bugzilla is working using Gmail; I've sent new-account notifications successfully, and users have created new accounts.

My employer would prefer for new-account notifications (and Bugzilla email in general) to come from our company email addresses on Outlook/Office365. I have been unable to sent email using Office365 so far.

I've read various posts on this topic but none have led to a resolution.

Various parameters I've tried:

********** smtpserver **********

Using 587 and 25, I get:
There was an error sending mail from '[redacted]@[redacted]' to '[redacted]@[redacted]': unable to establish SMTP connection to port 25

Using 483, I get:
The new value for smtpserver is invalid: Cannot connect to using port 483.

Using the direct-send SMTP server, I get:
There was an error sending mail from '[redacted]@[redacted]' to '[redacted]@[redacted]': unable to establish SMTP connection to [redacted] port 25

********** smtp_ssl **********


Using 'on', I get the error messages shown above.
Using 'off', I get:
There was an error sending mail from '[redacted]@[redacted]' to '[redacted]@[redacted]': failed AUTH: Command unknown: 'AUTH'

The mail_delivery_method drop-down does *not* have an SMTP-TLS option; it has Sendmail, SMTP, Test, None.

********** ********** indicates that almost everything is ok/found with the exception of:

In general, the output from looks fine, I don't see any glaring error messages or warnings.

********** access.log **********

Shows a normal GET request for /bugzilla/createaccount

********** error.log **********

Shows nothing.

Thorsten Schöning

May 25, 2018, 3:16:30 AM5/25/18
Guten Tag Alexander Farley,
am Freitag, 25. Mai 2018 um 01:57 schrieben Sie:

> SMTP email from Bugzilla is working using Gmail;

What's the exact settings you were using?


From my understanding, this with smt_ssl on should be the way to go.
Enable smtp_debug as well and look at the web server error log. If you
have some kind of firewall filtering between you and MS, check that as
well, maybe using Wireshark.

Additionally have a look at OpenSSL-packages, doesn't
know all 3rd dependencies need by some library. In the past
openssl-dev or such was missing for some users.

Mit freundlichen Grüßen,

Thorsten Schöning

Thorsten Schöning E-Mail:
AM-SoFT IT-Systeme

Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

Alexander Farley

May 25, 2018, 1:24:46 PM5/25/18
The working settings for Gmail were:

And of course I had Gmail credentials instead of my Office365/Outlook credentials.

I have a few more observations:

1) I'm able to send SMTP email manually using using the following command:
openssl s_client -CApath /etc/ssl/certs -starttls smtp -crlf -quiet -connect

2) The above command fails if you leave out -CApath /etc/ssl/certs

3) Bugzilla indicates "unable to establish SMTP connection to port 587".

So, I think this confirms:
-this is not a blocked-port issue; SMTP email has been successfully sent from my server using both port 483 and 587.
-the issue is probably not at the network/firewall level if the openssl command works
-the issue is probably not a missing openssl dependency, because the commmand-link SMTP transfer works

Another strange thing: even with smtp_debug enabled, and Bugzilla indicating "unable to establish SMTP connection to port 587", I don't see anything showing up in error.log.

Alexander Farley

May 25, 2018, 4:59:03 PM5/25/18
I have just tried sending email with the command-line tool ssmtp on my Bugzilla server and I'm able to successfully send email using Office365 (587) this way. I think this shows that it's almost certainly not an upstream issue; this must be related to the mechanism that Bugzilla uses to transmit SMTP email.

Alexander Farley

May 25, 2018, 6:37:12 PM5/25/18
I was able to get this working by reading this discussion:

I ended up using Email::Sender::Transport::SMTPS as specified by Frédéric Buclin. I had to read the docs for Email::Sender::Transport::SMTPS to know how to format the parameters.

This seems to be specific to Office365 since it requires actual TLS; using Gmail, you can get away with regular SSL.

Anyway, thanks for the feedback.

Dimitar Paskov

Feb 5, 2019, 8:37:14 AM2/5/19
The simplest workaround without installing any additional fixes or modules is to just manually edit the params.json and set "smtp_ssl" : "starttls". Note however that changing the email settings in Bugzilla will overwrite your value so if you want a permanent solution you should edit and in the if($method eq "SMTP") you should replace:

ssl => Bugzilla->params->{'smtp_ssl'},


$port eq "587" ? (ssl => "starttls") : (ssl => Bugzilla->params->{'smtp_ssl'}),

Jun 21, 2019, 1:54:01 AM6/21/19
This works perfectly

Thorsten Schöning

Jun 21, 2019, 3:07:18 AM6/21/19
Guten Tag,
am Freitag, 21. Juni 2019 um 07:54 schrieben Sie:

> This works perfectly

Your message would be more helpful for all users and their different
clients with actually quoting what "this" is. :-) Remember that not
all users have thread view of mails, don't even receive all mails at
all etc.

Jun 22, 2020, 1:25:35 AM6/22/20
On Friday, 21 June 2019 13:54:01 UTC+8, wrote:
> This works perfectly

So what works perfectly? Please explain more.

Thorsten Schöning

Jun 22, 2020, 2:50:23 AM6/22/20
Guten Tag,
am Montag, 22. Juni 2020 um 07:25 schrieben Sie:

> So what works perfectly? Please explain more.

The referenced answer was the following:

Bit you should really read the whole thread and I don't recommend
changing Bugzilla core code. TLS seems to simply not be supported

You might prefer a different solution like a local sendmail to forward
your mails with TLS-support.
Reply all
Reply to author
0 new messages