Add MAIL_ADDRESS environment variable #46

Merged
rfwatson merged 1 commit from plume/documentation:clarify_mail_options into dev 2019-05-30 09:50:45 +00:00
rfwatson commented 2019-05-30 07:48:08 +00:00 (Migrated from github.com)

If MAIL_ADDRESS is not set in the environment, the from address is constructed from the MAIL_USER and MAIL_SERVER variables.

However many providers (e.g. Mailgun) require a full email address to be passed as the username. This results in a from address like some@emailaccount@mailgun.com. Sending emails then fails due to Lettre's validity check, and no error is visible.

Email error handling can definitely be improved in the codebase too, but as a first step this should help new users avoid the same problem.

If `MAIL_ADDRESS` is not set in the environment, the from address is [constructed](https://github.com/rfwatson/Plume/blob/92eb13bf33c218aa4a7f6547c13aeecec2733695/src/mail.rs#L83-L86) from the `MAIL_USER` and `MAIL_SERVER` variables. However many providers (e.g. Mailgun) require a full email address to be passed as the username. This results in a from address like `some@emailaccount@mailgun.com`. Sending emails then fails due to Lettre's [validity check](https://github.com/lettre/lettre/blob/56b718f04dbacf1456c967669e81ee40e4bcd2b1/lettre/src/lib.rs#L55), and no error is visible. Email error handling can definitely be improved in the codebase too, but as a first step this should help new users avoid the same problem.
elegaanz (Migrated from github.com) approved these changes 2019-05-30 09:50:37 +00:00
elegaanz (Migrated from github.com) left a comment

Thank you!

Thank you!
Sign in to join this conversation.
No description provided.