lukevella / rallly

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
https://rallly.co
GNU Affero General Public License v3.0
3.56k stars 338 forks source link

MS Exchange (Office 365) SMTP - Error sending email #662

Closed flinthamm closed 1 year ago

flinthamm commented 1 year ago

Nodemailer will not support MS Exchange (Office 365) SMTP servers

Steps to reproduce the error:

SMTP_HOST=smtp.office365.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=user@domain.com
SMTP_PWD=secure-pwd-here

This should allow STARTLS encryption to connect and send an email via MS Exchange servers but instead it produces "Error sending email"

There was an issue raised (and now closed) late last year on the nodemailer repository itself #1482 and a solution was posted. Please can this be added to enable support for SMTP services that use STARTLS encryption like Office 365 and indeed our own internal mail server. This could optionally be enabled and disable by an additional environment variable which is disabled by default?

Add...

tls: {
ciphers: "SSLv3",
rejectUnauthorized: false,
},

Thanks for this truly great project.

I hope this is something that can be changed to enable people to use MS Exchange (Office 365) SMTP services.

lukevella commented 1 year ago

Hi @flinthamm, I believe it should work if you set SMTP_SECURE to true. Can you try that and let me know if that solves the problem?

flinthamm commented 1 year ago

Thanks for your reply.

Using docker with environment vars it doesn't work, having tried both true and false for this setting. The container just shows "Error sending email" in both cases. I'm pretty confident the changes mentioned would resolve this.

lukevella commented 1 year ago

I see. Thanks for raising this. I suppose the simplest thing is to hardcode the extra config you require but I'm not sure if this has some negative implications for other configs. I assume there is a better way to do this. I'll do some research and try to get a fix out for this asap but in the meantime if you know of other projects that already handle this I'd be very interested to see their implementation.

flinthamm commented 1 year ago

Thanks @lukevella I don't, but will be sure to post if I come across any, although this is an issue on the official nodemailer repository #1482 ? Can this not be added with an environment variable to support it that's just 'false' by default, so it can be enabled only if required? I did add this code in an earlier release (without the ciphers key) that fixed the issue with an internal mail server.

lukevella commented 1 year ago

Ok I understand what you mean. I will address this in an update this week. Thanks for raising.

flinthamm commented 1 year ago

No problem and that's great, will test and let you know once updated. Is there a flag for more verbose mail logging? Without intending to sound corny - keep up your great work :thumbsup:

lukevella commented 1 year ago

Hi @flinthamm, assuming you're using the image on docker hub can you try running rallly:with-tls and setting SMTP_TLS_ENABLED=true in your environment?

flinthamm commented 1 year ago

Spot on and thank you 👍

Tested with latest smtp.office365.com...

SMTP_SECURE=false
SMTP_TLS_ENABLED=true
lukevella commented 1 year ago

Thanks for confirming. I'll try to cut a new release soon once I sort out the documentation.

lukevella commented 1 year ago

This has been released in v2.10.0 so when can close this now. Thanks for raising.