-
Notifications
You must be signed in to change notification settings - Fork 728
Inconsistent format of email from header “name <email>” #277
Copy link
Copy link
Closed
Labels
difficulty: mediumfix is medium in difficultyfix is medium in difficultystatus: help wantedrequesting help from the communityrequesting help from the communitytype: community enhancementfeature request not on Twilio's roadmapfeature request not on Twilio's roadmap
Description
Issue Summary
Current implementation restrict use default email_from behavior. For more info please see https://tools.ietf.org/html/rfc2822#section-3.4
Steps to Reproduce
- When user try to create
Emailinstance from https://github.com/sendgrid/sendgrid-python/blob/master/sendgrid/helpers/mail/mail.py#L173-L179. You must specify
from_emailandfrom_nameas seperate parametrs
def get(self):
email = {}
if self.name != None:
email["name"] = self.name
if self.email != None:
email["email"] = self.email
return email
from_email = Email("[email protected]", "Example Name")
As a result client should split from_email:
try:
import rfc822
except ImportError:
import email.utils as rfc822
from_name, from_email = rfc822.parseaddr(email.from_email)
# Python sendgrid client should improve
# sendgrid/helpers/mail/mail.py:164
if not from_name:
from_name = None
Mail(from_email, from_name)
Proposal to how to improve this bahaviour.
Because if user now create Email from:
from_email = Email("Andrii Soldatenko <[email protected]>")
Technical details:
- sendgrid-python Version: master
- Python Version: all
References:
- Inconsistent format of email from header “name <email>” #277
- RFC: https://tools.ietf.org/html/rfc2822#section-3.4
- Django docs: https://docs.djangoproject.com/en/1.10/topics/email/#emailmessage-objects
NOTE:
In sengrid-python==1.4 this feature is working
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
difficulty: mediumfix is medium in difficultyfix is medium in difficultystatus: help wantedrequesting help from the communityrequesting help from the communitytype: community enhancementfeature request not on Twilio's roadmapfeature request not on Twilio's roadmap
