-
Notifications
You must be signed in to change notification settings - Fork 135
Allow multiple emails in the from_email argument #60
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
Comments
Oh, wow, I didn't know the RFC allowed multiple addresses in the From field. Learned something new today. Anymail extends Django's But FWIW, most (maybe all?) of the ESPs Anymail supports only allow a single from address in their APIs. So even if Django's EmailMessage allowed multiple from emails, they'd just turn into AnymailUnsupportedFeature errors. Can I ask how you're trying to use multiple from emails? There might be some other way to achieve a similar outcome. (E.g., the EmailMessage |
@medmunds The scenario I am running into is with a pseudo mail forwarding feature I have developed. That features generates a Exploring Django's EmailMessage source, I see that the message object If the issue is with Django I can consider opening a ticket there. Although Django's core message functionality seems to allow for it. I could be wrong. Thanks again for making the project regardless. This is a wonderful library to use and I am grateful it exists. |
Hmm, couple of things:
I can look at making that work in Anymail. But the problem is still going to be that most ESP send APIs don't allow multiple from addresses. And they tend to be pretty picky about allowing header overrides of standard fields like From. So it'll probably just be a different error getting raised. Which ESP(s) are you using? |
@medmunds We are currently using SendGrid. I just got off chat support with them. They appear to only support one email address-spec in the From field. Ugh. Not sure if other ESP's provide it. If you feel like closing the ticket that's fine. I will initiate a feature request with SendGrid to see if they can allow for that. Likely wouldn't be addressed anytime soon though. |
Yeah, not entirely surprising. (SendGrid's v3 API actively prevents multiple reply-to addresses, so it doesn't seem likely they'd handle multiple from emails.) You got me curious, though, and I ran some quick tests to see which ESPs would even support the
But: even if you switched to an ESP that supports them, you'd probably run into deliverability issues with multiple from addresses. Gmail flat-out rejects the message ("5.7.1 Messages with multiple addresses in From: header are not accepted. - gsmtp"). Outlook.com accepts the message, but seems to consider multiple from addresses a spam signal (my tests ended up in the junk folder). For completeness, I think I'm going to change Anymail to support a multi-address from_email string for Mailgun and SparkPost, and to issue a clearer "unsupported" error for the other ESPs. But in practice, multiple from addresses probably aren't all that usable. For your project, one approach I've seen with forwarding is encoding one email address in another. E.g.: |
@medmunds Thanks again for the help with creative solutions on my specific scenario. And for the responsiveness to the issue I created on the repo. |
@avelis no problem - thanks |
Exception Value: | Invalid address; only [email protected] could be parsed from [email protected],[email protected]" I am getting the above error while using in to or cc . |
@ajeetgupt1982 I appreciate your searching for related issues before opening a new one, but it sounds like you are seeing something different. This issue is specifically about multiple If you're having trouble with multiple recipients, please open a new issue (or ask a question on Stack Overflow), and be sure to include all of the information requested. In particular, which ESP, what version of Anymail, your code that tries to send the email, and the exact and complete error message. (The exception value you posted above doesn't appear in Anymail's code. There is a similar error, though, and if that's the one you're seeing, then you've added text and changed some important details as you pasted it here.) You may also want to take a look at the help page in Anymail's docs, if you haven't already. |
According to RFC-5322 Section 3.6.2, the From can be a mailbox list and the Sender can be a mailbox. I tried to set the from_email as a list of emails but caught an
AnymailInvalidAddress
when calling the send method.It feels like a bug with django-anymail but I am open for discussion/education on how to achieve this.
The text was updated successfully, but these errors were encountered: