Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Inconsistent format of email from header “name <email>” #277

Copy link
Copy link

Description

@andriisoldatenko
Issue body actions

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

  1. When user try to create Email instance from https://github.com/sendgrid/sendgrid-python/blob/master/sendgrid/helpers/mail/mail.py#L173-L179. You must specify
    from_email and from_name as 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("test@example.com", "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 <hello@asoldatenko.com>")

Actual result:
image

Technical details:

  • sendgrid-python Version: master
  • Python Version: all

References:

NOTE:
In sengrid-python==1.4 this feature is working

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.