Office365 SMTP: "unable to establish SMTP connection"

Background: 
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 ********** 

smtp.office365.com:587
smtp.office365.com:25
smtp.office365.com:483
[redacted]-com.mail.protection.outlook.com:25

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

Using 483, I get: 
The new value for smtpserver is invalid: Cannot connect to smtp.office365.com 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]-com.mail.protection.outlook.com port 25

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

on
off

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. 

**********  checksetup.pl ********** 

checksetup.pl indicates that almost everything is ok/found with the exception of:
DBD-SQLite
DBD-Oracle
DBD-Pg
PatchReader
Email-Reply
Apache-SizeLimit
Cache-Memcached
File-Copy-Recursive
File-Which
mod_rewrite

In general, the output from checksetup.pl 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.





0
Alexander
5/24/2018 11:57:48 PM
mozilla.support.bugzilla 10000 articles. 0 followers. Post Follow

4 Replies
63 Views

Similar Articles

[PageSpeed] 44

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?

> smtp.office365.com:587

From=20my 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, checksetup.pl 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=FC=DFen,

Thorsten Sch=F6ning

--=20
Thorsten Sch=F6ning       E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

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=E4ftsf=FChrer: Andreas Muchow

0
windows
5/25/2018 7:15:45 AM
On Friday, May 25, 2018 at 1:16:30 AM UTC-6, Thorsten Sch=C3=B6ning wrote:
> Guten Tag Alexander Farley,
> am Freitag, 25. Mai 2018 um 01:57 schrieben Sie:
>=20
> > SMTP email from Bugzilla is working using Gmail;
>=20
> What's the exact settings you were using?
>=20
> > smtp.office365.com:587
>=20
> 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.
>=20
> Additionally have a look at OpenSSL-packages, checksetup.pl doesn't
> know all 3rd dependencies need by some library. In the past
> openssl-dev or such was missing for some users.
>=20
> Mit freundlichen Gr=C3=BC=C3=9Fen,
>=20
> Thorsten Sch=C3=B6ning
>=20
> --=20
> Thorsten Sch=C3=B6ning       E-Mail: Thorsten.Schoening@AM-SoFT.de
> AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
>=20
> Telefon...........05151-  9468- 55
> Fax...............05151-  9468- 88
> Mobil..............0178-8 9468- 04
>=20
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Gesch=C3=A4ftsf=C3=BChrer: Andreas Muchow

The working settings for Gmail were:
smtp.gmail.com:483
smtp_ssl:on

And of course I had Gmail credentials instead of my Office365/Outlook crede=
ntials.=20

I have a few more observations:

1) I'm able to send SMTP email manually using smtp.gmail.com:587 using the =
following command:
openssl s_client -CApath /etc/ssl/certs -starttls smtp -crlf -quiet -connec=
t smtp.gmail.com:587

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

3) Bugzilla indicates "unable to establish SMTP connection to smtp.gmail.co=
m port 587".=20

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

Another strange thing: even with smtp_debug enabled, and Bugzilla indicatin=
g "unable to establish SMTP connection to smtp.gmail.com port 587", I don't=
 see anything showing up in error.log.=20



0
Alexander
5/25/2018 5:24:44 PM
On Friday, May 25, 2018 at 11:24:46 AM UTC-6, Alexander Farley wrote:
> On Friday, May 25, 2018 at 1:16:30 AM UTC-6, Thorsten Sch=C3=B6ning wrote=
:
> > Guten Tag Alexander Farley,
> > am Freitag, 25. Mai 2018 um 01:57 schrieben Sie:
> >=20
> > > SMTP email from Bugzilla is working using Gmail;
> >=20
> > What's the exact settings you were using?
> >=20
> > > smtp.office365.com:587
> >=20
> > 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.
> >=20
> > Additionally have a look at OpenSSL-packages, checksetup.pl doesn't
> > know all 3rd dependencies need by some library. In the past
> > openssl-dev or such was missing for some users.
> >=20
> > Mit freundlichen Gr=C3=BC=C3=9Fen,
> >=20
> > Thorsten Sch=C3=B6ning
> >=20
> > --=20
> > Thorsten Sch=C3=B6ning       E-Mail: Thorsten.Schoening@AM-SoFT.de
> > AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
> >=20
> > Telefon...........05151-  9468- 55
> > Fax...............05151-  9468- 88
> > Mobil..............0178-8 9468- 04
> >=20
> > AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> > AG Hannover HRB 207 694 - Gesch=C3=A4ftsf=C3=BChrer: Andreas Muchow
>=20
> The working settings for Gmail were:
> smtp.gmail.com:483
> smtp_ssl:on
>=20
> And of course I had Gmail credentials instead of my Office365/Outlook cre=
dentials.=20
>=20
> I have a few more observations:
>=20
> 1) I'm able to send SMTP email manually using smtp.gmail.com:587 using th=
e following command:
> openssl s_client -CApath /etc/ssl/certs -starttls smtp -crlf -quiet -conn=
ect smtp.gmail.com:587
>=20
> 2) The above command fails if you leave out -CApath /etc/ssl/certs
>=20
> 3) Bugzilla indicates "unable to establish SMTP connection to smtp.gmail.=
com port 587".=20
>=20
> So, I think this confirms:=20
> -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 c=
ommand works
> -the issue is probably not a missing openssl dependency, because the comm=
mand-link SMTP transfer works
>=20
> Another strange thing: even with smtp_debug enabled, and Bugzilla indicat=
ing "unable to establish SMTP connection to smtp.gmail.com port 587", I don=
't see anything showing up in error.log.

I have just tried sending email with the command-line tool ssmtp on my Bugz=
illa server and I'm able to successfully send email using Office365 (587) t=
his way. I think this shows that it's almost certainly not an upstream issu=
e; this must be related to the mechanism that Bugzilla uses to transmit SMT=
P email.=20

0
Alexander
5/25/2018 8:59:01 PM
On Friday, May 25, 2018 at 2:59:03 PM UTC-6, Alexander Farley wrote:
> On Friday, May 25, 2018 at 11:24:46 AM UTC-6, Alexander Farley wrote:
> > On Friday, May 25, 2018 at 1:16:30 AM UTC-6, Thorsten Sch=C3=B6ning wro=
te:
> > > Guten Tag Alexander Farley,
> > > am Freitag, 25. Mai 2018 um 01:57 schrieben Sie:
> > >=20
> > > > SMTP email from Bugzilla is working using Gmail;
> > >=20
> > > What's the exact settings you were using?
> > >=20
> > > > smtp.office365.com:587
> > >=20
> > > 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 yo=
u
> > > have some kind of firewall filtering between you and MS, check that a=
s
> > > well, maybe using Wireshark.
> > >=20
> > > Additionally have a look at OpenSSL-packages, checksetup.pl doesn't
> > > know all 3rd dependencies need by some library. In the past
> > > openssl-dev or such was missing for some users.
> > >=20
> > > Mit freundlichen Gr=C3=BC=C3=9Fen,
> > >=20
> > > Thorsten Sch=C3=B6ning
> > >=20
> > > --=20
> > > Thorsten Sch=C3=B6ning       E-Mail: Thorsten.Schoening@AM-SoFT.de
> > > AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
> > >=20
> > > Telefon...........05151-  9468- 55
> > > Fax...............05151-  9468- 88
> > > Mobil..............0178-8 9468- 04
> > >=20
> > > AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> > > AG Hannover HRB 207 694 - Gesch=C3=A4ftsf=C3=BChrer: Andreas Muchow
> >=20
> > The working settings for Gmail were:
> > smtp.gmail.com:483
> > smtp_ssl:on
> >=20
> > And of course I had Gmail credentials instead of my Office365/Outlook c=
redentials.=20
> >=20
> > I have a few more observations:
> >=20
> > 1) I'm able to send SMTP email manually using smtp.gmail.com:587 using =
the following command:
> > openssl s_client -CApath /etc/ssl/certs -starttls smtp -crlf -quiet -co=
nnect smtp.gmail.com:587
> >=20
> > 2) The above command fails if you leave out -CApath /etc/ssl/certs
> >=20
> > 3) Bugzilla indicates "unable to establish SMTP connection to smtp.gmai=
l.com port 587".=20
> >=20
> > So, I think this confirms:=20
> > -this is not a blocked-port issue; SMTP email has been successfully sen=
t 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 co=
mmmand-link SMTP transfer works
> >=20
> > Another strange thing: even with smtp_debug enabled, and Bugzilla indic=
ating "unable to establish SMTP connection to smtp.gmail.com port 587", I d=
on't see anything showing up in error.log.
>=20
> I have just tried sending email with the command-line tool ssmtp on my Bu=
gzilla 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 is=
sue; this must be related to the mechanism that Bugzilla uses to transmit S=
MTP email.

I was able to get this working by reading this discussion:
https://bugzilla.mozilla.org/show_bug.cgi?id=3D1182445

I ended up using Email::Sender::Transport::SMTPS as specified by 	Fr=C3=A9d=
=C3=A9ric Buclin. I had to read the docs for Email::Sender::Transport::SMTP=
S 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.
0
Alexander
5/25/2018 10:37:10 PM
Reply: