charmbracelet / pop

Send emails from your terminal 📬
MIT License
2.36k stars 49 forks source link

Resend API key required even with custom SMTP #26

Open ro78 opened 1 year ago

ro78 commented 1 year ago

Describe the bug Since a recent release, we can use an external (custom) SMTP instead of Resend. But when I try to use it, it's still asks me to configure a Resend API key.

To Reproduce Steps to reproduce the behavior:

  1. Install pop on a clear host
  2. Run the command pop --smtp.host localhost --smtp.port 25 --from noreply@exemple.com
  3. See error

Expected behavior Pop doesn't display any error related to Resend

Screenshots 2023-08-14_113536

Desktop (please complete the following information):

ro78 commented 1 year ago

I found that username & password is mandatory. I think it's better to accept using SMTP without them, as some hosts are trusted relays without any auth.

p-i-c-o commented 1 year ago

Any update on this?? still having the same issue.

p-i-c-o commented 1 year ago

@ro78 any update??

ro78 commented 1 year ago

Any update from me? No, I reported this bug and I don't have any update from the developer.

p-i-c-o commented 1 year ago

Any update from me? No, I reported this bug and I don't have any update from the developer.

Ok, thank you anyways

ltdangle commented 11 months ago

Looks like currently it's a feature, not a bug. You can't set smtp credential via command line, you have to set them via environment variables.

p4tpr0 commented 1 week ago

That’s a bug. You should be able to post though a local SMTP without authentication.

compare

$ export POP_SMTP_HOST=localhost
$ export POP_SMTP_PORT=25
$ pop

   ERROR   RESEND_API_KEY  environment variable is required.

   You can grab one at https://resend.com/api-keys

with:

$ export POP_SMTP_HOST=localhost
$ export POP_SMTP_PORT=25
$ export POP_SMTP_USERNAME=foo
$ export POP_SMTP_PASSWORD=bar
$ pop

 From foo                              
 To you@example.com                    
 Subject Hello!                        

 ┃ # Email                             
…

Anyway, you can work around that limitation by setting: a bogus POP_SMTP_USERNAME and a bogus POP_SMTP_PASSWORD and POP_SMTP_ENCRYPTION=none

$ export POP_SMTP_HOST=localhost
$ export POP_SMTP_PORT=25
$ export POP_SMTP_USERNAME=foo
$ export POP_SMTP_PASSWORD=bar
$ export POP_SMTP_ENCRYPTION=none
$ pop

(it works!)

Also, pop makes a(nother) very unwelcome assumption, for a TUI software: it forces the use of fully qualified From and To email addresses (user@domain.tld). From a "terminal" perspective, especially with POP_SMTP_HOST=localhost a user expects being able to send emails from & to local addresses:

$ pop

 From user1                              
 To user2                    
 Subject Hello!                        

 ┃ # Email                             
…

An email address of the form "user" is perfectly legitimate on the local system.