#2264 - SES - Ensure verify_email_address works with display names
This commit is contained in:
parent
60c98ca836
commit
f0cab68208
@ -91,9 +91,11 @@ class SESBackend(BaseBackend):
|
|||||||
return host in self.domains
|
return host in self.domains
|
||||||
|
|
||||||
def verify_email_identity(self, address):
|
def verify_email_identity(self, address):
|
||||||
|
_, address = parseaddr(address)
|
||||||
self.addresses.append(address)
|
self.addresses.append(address)
|
||||||
|
|
||||||
def verify_email_address(self, address):
|
def verify_email_address(self, address):
|
||||||
|
_, address = parseaddr(address)
|
||||||
self.email_addresses.append(address)
|
self.email_addresses.append(address)
|
||||||
|
|
||||||
def verify_domain(self, domain):
|
def verify_domain(self, domain):
|
||||||
|
@ -214,3 +214,16 @@ def test_send_raw_email_without_source_or_from():
|
|||||||
kwargs = dict(RawMessage={"Data": message.as_string()})
|
kwargs = dict(RawMessage={"Data": message.as_string()})
|
||||||
|
|
||||||
conn.send_raw_email.when.called_with(**kwargs).should.throw(ClientError)
|
conn.send_raw_email.when.called_with(**kwargs).should.throw(ClientError)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_ses
|
||||||
|
def test_send_email_notification_with_encoded_sender():
|
||||||
|
sender = "Foo <foo@bar.baz>"
|
||||||
|
conn = boto3.client("ses", region_name="us-east-1")
|
||||||
|
conn.verify_email_identity(EmailAddress=sender)
|
||||||
|
response = conn.send_email(
|
||||||
|
Source=sender,
|
||||||
|
Destination={"ToAddresses": ["your.friend@hotmail.com"]},
|
||||||
|
Message={"Subject": {"Data": "hi",}, "Body": {"Text": {"Data": "there",}}},
|
||||||
|
)
|
||||||
|
response["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
||||||
|
Loading…
Reference in New Issue
Block a user