pglombardo / PasswordPusher

🔐 Securely share sensitive information with automatic expiration & deletion after a set number of views or duration. Track who, what and when with full audit logs.
https://docs.pwpush.com
Apache License 2.0
1.94k stars 339 forks source link

Sending mail with gmail's smtp server doesn't work. But it works with ssmtp... #2013

Closed mathsyx69 closed 4 months ago

mathsyx69 commented 5 months ago

🐛 Bug Report

Hello, I try several things to resolve the mail sending with gmail smtp which doesn't work on my pwpush instance but I doesn't find any solution. Do you have any idea ?

Thank by advance.

🔬 How To Reproduce

Steps to reproduce the behavior:

Configure SMTP with gmail smtp with starttls (app password).

Config

I apply my config with settings.yml.

config : raise_delivery_errors: false smtp_address: 'smtp.gmail.com' smtp_user_name: '---XXXX---' smtp_password: '---XXXX---' smtp_domain: '---XXXX---' smtp_port: '587' smtp_authentication: 'plain' smtp_starttls: true smtp_enable_starttls_auto: false smtp_read_timeout: 10 smtp_open_timeout: 10 smtp_openssl_verify_mode: 'peer' mailer_sender: '"Password Pusher" <---XXXX--->'

enable_logins: true disable_signups: true

log_level: :debug

---XXXX--- -> sensitive values removed from config

I have already try to set "smtp_enable_starttls_auto" to auto but it didn't change anything. I also try to change "smtp_authentication" to login but it didn't change anything.

Environment

Where are you running/using Password Pusher?

Podman containers running as systemd units with :

Screenshots

I try the mail send with the lost password functionality. I get the message on the web page that I will receive the email to reset the password, but I never receive it.

Logs didn't give me much information... image

I display the config with rails console and try to test the config but I have the same bug of the issue #2001

image

📈 Expected behavior

Receive mails send by my passwordpusher instance.

📎 Additional context

To make sure the problem not come from passwordpusher I have try the mail send with ssmtp and it's work well with the same settings has password pusher config :

image

pglombardo commented 4 months ago

Hi @mathsyx69 - thanks for reporting. I know that a subset of users have problem configuring email and up to now I haven't figured out why (yet).

I'll take a deeper look at this very soon in the hope of fixing it once and for all.

pglombardo commented 4 months ago

Hi @mathsyx69 - In v1.39.8, I added a tool to better test email issues. Could you update to that version and try this out? It should hopefully point us in the right direction.

mathsyx69 commented 4 months ago

Hi @pglombardo - I have install and try the tool with same mail setting as before. I got this result : image

The mail isn't send / received. The problem come from STARTTLS.

I manage to make smtp gmail working by follow your "Know working configuration" section in documentation : https://github.com/pglombardo/PasswordPusher/wiki/How-to-Validate-and-Test-Email-Settings#gmail

My final working config :

mail: raise_delivery_errors: true smtp_address: 'smtp.gmail.com' smtp_user_name: '' smtp_password: '' smtp_domain: '' smtp_port: '587' smtp_authentication: 'plain' smtp_starttls: true smtp_enable_starttls_auto: true smtp_open_timeout: 10 smtp_read_timeout: 10

smtp_openssl_verify_mode: 'peer'

mailer_sender: '"Password Pusher" '

image

Thank for the correction 😊.

At my work we plan to use Password Pusher with Microsoft 365 smtp but the mail send doesn't work. I will try to fix with help your new feature and open a new issue to help if I manage to solve.

pglombardo commented 4 months ago

Excellent 😎

mathsyx69 commented 4 months ago

I have tested the configuration for Microsoft 365 / Exchange Online Authenticated SMTP, this work with this config.

The authentication method "plain" isn't supported by smtp.office365.com but the method "login" is supported.

mail: raise_delivery_errors: true smtp_address: 'smtp.office365.com' smtp_user_name: 'm365 email' smtp_password: 'm365 password'

smtp_domain: 'outlook.com' //optionnal it work with or without it

smtp_port: '587' smtp_authentication: 'login' smtp_starttls: true smtp_enable_starttls_auto: true smtp_open_timeout: 10 smtp_read_timeout: 10

mailer_sender: '"Password Pusher" \<m365 email>'

pglombardo commented 4 months ago

Thanks @mathsyx69 - I've added that to the known configurations. Much appreciated.