Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unauthenticated SMTP fails "No SMTP username provided" #2471

Open
2 of 21 tasks
kaffe19 opened this issue Aug 29, 2024 · 7 comments
Open
2 of 21 tasks

Unauthenticated SMTP fails "No SMTP username provided" #2471

kaffe19 opened this issue Aug 29, 2024 · 7 comments

Comments

@kaffe19
Copy link

kaffe19 commented Aug 29, 2024

🐛 Bug Report

🔬 How To Reproduce

Steps to reproduce the behavior:

  1. pull pglombardo/pwpush:latest

  2. set PWP__MAIL__SMTP_ENABLE_STARTTLS_AUTO -> false

  3. do not set PWP__MAIL__SMTP_AUTHENTICATION, PWP__MAIL__SMTP_USER_NAME or PWP__MAIL__SMTP_PASSWORD
    (exactly as when it was working before)

  4. send test mail from console: password-pusher(prod)> TestMailer.send_test_email("[email protected]").deliver_now

--> Configured FROM: address: '[email protected]'
app/mailers/test_mailer.rb:7:in `send_test_email': No SMTP username provided: smtp_user_name (StandardError)

SMTPsettings:

password-pusher(prod)> Rails.application.config.action_mailer.smtp_settings
=> {:address=>"mysmtpserver.example.com", :port=>25, :open_timeout=>10, :read_timeout=>10, :enable_starttls_auto=>false}

Where are you running/using Password Pusher?

  • pwpush.com
  • Docker Image
    • pwpush
    • Custom image
  • Heroku
  • Digital Ocean
    • App Platform
    • Kubernetes Service
  • Microsoft Azure
    • App Service
    • Container Instances (ACI)
    • Kubernetes Service (AKS)
  • Google Cloud
    • App Engine
    • Cloud Run
    • Kubernetes Engine
  • AWS
    • Elastic Container Service (ECS)
    • Kubernetes Service (AKS)
  • Source Code
  • Other (please specify)

📈 Expected behavior

Mail should be deliverd to SMTP server unauthenticaded on port 25, in case user is not set.

Copy link

Hello @kaffe19, thanks for contributing to the Password Pusher community! We will respond as soon as possible.

@MadWalnut
Copy link

I have the exact same problem, also using Docker.

@pglombardo Perhaps adding a configuration example for unauthenticated SMTP on port 25 to the docs would be helpful as well?

@tol0
Copy link

tol0 commented Sep 24, 2024

Same here, would be great to have this fixed. Any workaround?

@pglombardo
Copy link
Owner

Hi all - just an update. I'm looking at this today.

@pglombardo
Copy link
Owner

I think it's been more than ~10 years since I setup a local postfix instance. :-)

I made some fixes and got email working with postfix on localhost:25. v1.45.10 is building now.

Could you update your containers and revalidate with the TestMailer? Fingers crossed, this should be an improvement.

@MadWalnut - once I get validations, I'll add local mail server instructions to the docs for sure.

@pglombardo
Copy link
Owner

FWIW, this was my output with the updated TestMailer.

I left smtp_address and smtp_port commented out and the system defaults to localhost:25.

password-pusher(dev)> TestMailer.send_test_email("[email protected]").deliver_now

--> Configured FROM: address: '"Password Pusher" <[email protected]>'
--> No SMTP address provided. Mail subsystem should default to localhost.

The settings.yml mail configuration is:
----------
raise_delivery_errors: false
smtp_port: 587  <--- ignore: this is the default.  Not used unless smtp_address is set
smtp_enable_starttls_auto: true
smtp_open_timeout: 10
smtp_read_timeout: 10
mailer_sender: "Password Pusher" <[email protected]>
----------

The Mail subsystem SMTP configuration is:
----------
address:
port:
open_timeout: 10
read_timeout: 10
enable_starttls_auto: true
----------

--> raise_delivery_errors is set to false.  Set to true to see errors if the email fails to send.

--> Attempting to send a test email to [email protected]...
--> ✅  It seems that the Email was accepted by the SMTP server!  Check destination inbox for the test email.

--> If you see an error, please paste this output into a GitHub issue for help.
  --> Make sure that no sensitive data is included.
  --> https://github.com/pglombardo/PasswordPusher/issues/new/choose

TestMailer#send_test_email: processed outbound mail in 11.2ms
Delivered mail 66f2fd7326504_1a6716a84233c@postfix10onubuntu2404-s-1vcpu-2gb-ams3-01.mail (89.8ms)
Date: Tue, 24 Sep 2024 17:57:07 +0000
From: Password Pusher <[email protected]>
To: [email protected]
Message-ID: <66f2fd7326504_1a6716a84233c@postfix10onubuntu2404-s-1vcpu-2gb-ams3-01.mail>
Subject: Test Email from Password Pusher
Mime-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable

=E2=AD=90 If you are reading this, sending email works! =E2=AD=90=

=> #<Mail::Message:28360, Multipart: false, Headers: <Date: Tue, 24 Sep 2024 17:57:07 +0000>, <From: "Password Pusher" <[email protected]>>, <To: [email protected]>, <Message-ID: <66f2fd7326504_1a6716a84233c@postfix10onubuntu2404-s-1vcpu-2gb-ams3-01.mail>>, <Subject: Test Email from Password Pusher>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: quoted-printable>>

@kaffe19
Copy link
Author

kaffe19 commented Sep 24, 2024

It seems to work. I do now recieve password reset emails aswell as emails from TestMailer. Well done!

This is my TestMailer output:

The settings.yml mail configuration is:
----------
raise_delivery_errors: false
smtp_port: 25
smtp_enable_starttls_auto: false
smtp_open_timeout: 10
smtp_read_timeout: 10
smtp_starttls: false
smtp_address: xxxxx.yy
mailer_sender: [email protected]
----------

The Mail subsystem SMTP configuration is:
----------
address: xxxxx.yy
port: 25
open_timeout: 10
read_timeout: 10
enable_starttls_auto: false
----------

--> raise_delivery_errors is set to false.  Set to true to see errors if the email fails to send.

--> Attempting to send a test email to [email protected]...
--> ✅   It seems that the Email was accepted by the SMTP server!  Check destination inbox for the test email.

--> If you see an error, please paste this output into a GitHub issue for help.
  --> Make sure that no sensitive data is included.
  --> https://github.com/pglombardo/PasswordPusher/issues/new/choose

=> #<Mail::Message:165740, Multipart: false, Headers: <Date: Tue, 24 Sep 2024 19:46:21 +0000>, <From: [email protected]>, <To: [email protected]>, <Message-ID: <[email protected]>>, <Subject: Test Email from Password Pusher>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: quoted-printable>>

@pglombardo pglombardo changed the title Untauthenticated SMTP fails "No SMTP username provided" Unauthenticated SMTP fails "No SMTP username provided" Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants