docusealco / docuseal

Open source DocuSign alternative. Create, fill, and sign digital documents ✍️
https://www.docuseal.co
GNU Affero General Public License v3.0
5.97k stars 410 forks source link

Exchange Online SMTP Auth #46

Closed hennibadger16 closed 9 months ago

hennibadger16 commented 1 year ago

Hi there!

Looks really promising but I just can't seem to get mails running via Exchange Online SMTP Auth.

Has there been tested and verified?

Can you share a working setup? Or where to find some helpful logging as "docker logs" does not seem to catch it.

Much appreciated!

Thanks :)

AlexandrToorchyn commented 1 year ago

@hennibadger16 I was able to verify this because I don't have access to such type of SMTP Auth. You can share the error information and maybe I can help you after that

hennibadger16 commented 1 year ago

Hi,

yeah that's my problem. There is just nothing happening when trying to send a mail after putting in credentials. I can't seem to find a relevant logfile as "docker logs" does not log it. Can you tell me where to look?

Thank you!

AlexandrToorchyn commented 1 year ago

@hennibadger16 Try docker logs -f docuseal

hennibadger16 commented 1 year ago

Hi, that's all that seems related:

I, [2023-08-02T07:28:12.108577 #1] INFO -- : [ActiveJob] [ActionMailer::MailDeliveryJob] [bd226dce-c233-47ee-b830-37e1d2ddeb07] Performing ActionMailer::MailDeliveryJob (Job ID: bd226dce-c233-47ee-b830-37e1d2ddeb07) from Async(default) enqueued at 2023-08-02T07:28:12Z with arguments: "SubmitterMailer", "invitation_email", "deliver_now!", {:args=>[#<GlobalID:0x00007ff41d00dd18 @uri=#<URI::GID gid://docu-seal/Submitter/27>>, {:message=>"You have been invited to submit the \"Agreement | Local Administrative Permissions\" form:"}]} I, [2023-08-02T07:28:12.218916 #1] INFO -- : [053c22eb-a4b5-428b-8354-cbc22ea64d9d] {"method":"GET","path":"/templates/1","format":"turbo_stream","controller":"TemplatesController","action":"show","status":200,"duration":17.43,"view":10.73,"db":2.55,"fwd":"85.22.69.98"} E, [2023-08-02T07:28:17.265430 #1] ERROR -- : [ActiveJob] [ActionMailer::MailDeliveryJob] [bd226dce-c233-47ee-b830-37e1d2ddeb07] Error performing ActionMailer::MailDeliveryJob (Job ID: bd226dce-c233-47ee-b830-37e1d2ddeb07) from Async(default) in 5192.33ms: Net::ReadTimeout (Net::ReadTimeout with #<Socket:(closed)>): /usr/local/lib/ruby/3.2.0/net/protocol.rb:229:inrbuf_fill' /usr/local/lib/ruby/3.2.0/net/protocol.rb:199:in readuntil' /usr/local/lib/ruby/3.2.0/net/protocol.rb:209:inreadline' /usr/local/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1057:in recv_response' /usr/local/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1051:inget_response' /usr/local/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:843:in block in auth_plain' /usr/local/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1067:incritical' /usr/local/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:842:in auth_plain' /usr/local/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:837:inpublic_send' /usr/local/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:837:in authenticate' /usr/local/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:670:indo_start' /usr/local/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:611:in start' /usr/local/bundle/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rb:109:instart_smtp_session' /usr/local/bundle/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rb:100:in deliver!' /usr/local/bundle/gems/mail-2.8.1/lib/mail/message.rb:269:indeliver!' /usr/local/bundle/gems/actionmailer-7.0.5/lib/action_mailer/message_delivery.rb:109:in block in deliver_now!' /usr/local/bundle/gems/actionmailer-7.0.5/lib/action_mailer/rescuable.rb:17:inhandle_exceptions' /usr/local/bundle/gems/actionmailer-7.0.5/lib/action_mailer/message_delivery.rb:108:in deliver_now!' /usr/local/bundle/gems/actionmailer-7.0.5/lib/action_mailer/mail_delivery_job.rb:23:inperform' /usr/local/bundle/gems/activejob-7.0.5/lib/active_job/execution.rb:59:in block in _perform_job' /usr/local/bundle/gems/activesupport-7.0.5/lib/active_support/callbacks.rb:118:inblock in run_callbacks' `

AlexandrToorchyn commented 1 year ago

@hennibadger16 Your SMTP host is unavailable (5192.33ms: Net::ReadTimeout). First, make sure you have access to it. Here is this link you might find helpful.

hennibadger16 commented 1 year ago

yeah - that's working perfectly fine. Has of course been tested in advance :)

AlexandrToorchyn commented 1 year ago

@hennibadger16 I wish I could help you, but I'm out of ideas and can't reproduce this bug. Sorry 😞

lordpayder commented 12 months ago

Hi, I'm also trying to setup smtp with Office 365, without success.

A few hours ago I setup another application (paperless-ngx) that required incoming E-Mails (IMAP) and struggled a bit with O365. I got it working using a email oauth2 proxy. This proxy also supports smtp, so I gave that a try, also without success.

I noticed in the proxy logs that the SMTP encoding is set to SMTPUTF8. I had to change the encoding for IMAP to US-ASCII to work in paperless-ngx, so my guess is the same encoding is required for SMTP too.

Omnichannel-nz commented 11 months ago

No luck here either, even after setting up an M365 relay. Source.

I'm getting "SSL_connect returned=1 errno=0 peeraddr=104.47.71.202:25 state=error: wrong version number" when using [domain].mail.protection.outlook.com on port 25, plain authentication, and TLS.

SSL and Login authentication make no difference.

AlexandrToorchyn commented 11 months ago

@Omnichannel-nz but does it work with security: none?

Would appreciate it a lot if anyone could share some test SMTP credentials form their exchange server to help me to debug the issue (my email is @.) On Sep 26 2023, at 9:00 am, "Omnichannel.nz" @.> wrote:

No luck here either, even after setting up an M365 relay. Source (https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365#settings-for-microsoft-365-or-office-365-smtp-relay). I'm getting "SSL_connect returned=1 errno=0 peeraddr=104.47.71.202:25 state=error: wrong version number" when using port 25, plain authentication, and TLS. SSL and Login authentication make no difference. — Reply to this email directly, view it on GitHub (https://github.com/docusealco/docuseal/issues/46#issuecomment-1734879377), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAI7GL2HMMJQWH6XNQ3B7DDX4JVP7ANCNFSM6AAAAAA26AULLY). You are receiving this because you commented.

skyrunner15 commented 11 months ago

Similar error using AWS SES as the SMTP provider -> SSL_connect returned=1 errno=0 state=error: wrong version number

phrz commented 10 months ago

I had this issue with M365 normally, with an Exchange Connector registered to my docuseal hostname, and with Fastmail (a completely different email provider with full SMTP support, unlike M365). I am curious what email providers docuseal has been tested against?

Omnichannel-nz commented 10 months ago

No luck here either, even after setting up an M365 relay. Source.

I'm getting "SSL_connect returned=1 errno=0 peeraddr=104.47.71.202:25 state=error: wrong version number" when using [domain].mail.protection.outlook.com on port 25, plain authentication, and TLS.

SSL and Login authentication make no difference.

I should mention that this is now resolved. Fix implemented by Docuseal to remove username/password requirement, no longer mandatory so that IP Whitelist M365 SMTP Relay could operate without account credentials. (Source)

omohokcoj commented 9 months ago

Looks like those issues with Outlook are not related to the app but to SMTP misconfigurations (wrong port/auth). Also SMTP should be enabled in office365 by the organization admin. Closing since the issue is not related to the app