ix-ai / smtp

This is a SMTP docker container for sending emails. You can also relay emails to gmail and amazon SES.
MIT License
92 stars 14 forks source link

Amazon SES environment variables did not include MAIL FROM values #18

Closed jeremyng123 closed 1 year ago

jeremyng123 commented 1 year ago

What did i do?

I have added the SES_USER and SES_PASSWORD environment variables to the docker image.

When it receives an email request, i can see that it authenticates successfully.

What did I expect to happen?

I expect that the request made to the SMTP container to be sent to the SES service successfully, and then the receipient (my test email address) should receive the email

What problems did I face?

However, when applying the details from the request, it leaves the "MAIL FROM" empty. This is an example of the log that I received:

mail_1          |   290   SMTP<< 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-d-smtp.ap-southeast-1.amazonaws.com
mail_1          |   290   SMTP>> EHLO f7b2e5901055
mail_1          |   290   SMTP<< 250-email-smtp.amazonaws.com
mail_1          |   290          250-8BITMIME
mail_1          |   290          250-STARTTLS
mail_1          |   290          250-AUTH PLAIN LOGIN
mail_1          |   290          250 Ok
mail_1          |   290   SMTP>> STARTTLS
mail_1          |   290   SMTP<< 220 Ready to start TLS
mail_1          |   290   SMTP>> EHLO f7b2e5901055
mail_1          |   290   SMTP<< 250-email-smtp.amazonaws.com
mail_1          |   290          250-8BITMIME
mail_1          |   290          250-STARTTLS
mail_1          |   290          250-AUTH PLAIN LOGIN
mail_1          |   290          250 Ok
mail_1          |   290   SMTP>> AUTH PLAIN ${REDACTED}
mail_1          |   290   SMTP<< 235 Authentication successful.
mail_1          |   290   SMTP>> MAIL FROM:<>
mail_1          |   290   SMTP<< 501 Invalid MAIL FROM address provided
mail_1          |   290   SMTP>> QUIT
mail_1          |   290   SMTP(close)>>
mail_1          |   289 LOG: MAIN
mail_1          |   289   ** info@example.com R=smarthost T=remote_smtp_smarthost H=email-smtp.ap-southeast-1.amazonaws.com ${REDACTED} X=TLS1.2:ECDHE_SECP256R1__RSA_SHA256__AES_256_GCM:256 CV=yes DN="CN=email-smtp.ap-southeast-1.amazonaws.com": SMTP error from remote mail server after MAIL FROM:<>: 501 Invalid MAIL FROM address provided

What am i expecting to be fixed?

Are there any environment variables required to populate the "MAIL_FROM"? I am using another docker image that relies on this SMTP server for sending emails. I dont expect to have different emails to send on behalf of the server (use case is to notify the users in the organization).

Please assist, thank you!

tlex commented 1 year ago

The value for MAIL_FROM comes from the actual e-mail client that connects to this container. In your case, it's the "another docker image" that needs to be configured.

Basically, the e-mail address that that image is using for sending out emails needs to be one accepted by AWS.