Repository: getmoto/moto

Issue:
verify_email_address doesn't allow sending mails
When I verify email using `verify_email_address`, it's not enough to send email - SESBackend respects only `verify_email_identity`.

How to reproduce:
```
conn = boto3.client("ses")
conn.verify_email_address(EmailAddress="sender@example.com")
# conn.list_verified_email_addresses() now have `sender@example.com`
conn.send_email(
        Destination={
            "ToAddresses": ["recipient1@example.com", "recipient2@example.com",],
        },
        Message={
            "Body": {
                "Html": {
                    "Charset": "UTF-8",
                    "Data": 'This message body contains HTML formatting.',
                },
                "Text": {
                    "Charset": "UTF-8",
                    "Data": "This is the message body in text format.",
                },
            },
            "Subject": {"Charset": "UTF-8", "Data": "Test email",},
        },
        Source="sender@example.com",
    )
```

This raises:
```
botocore.errorfactory.MessageRejected: An error occurred (MessageRejected) when calling the SendEmail operation: Email address not verified sender@example.com
```

It's occurred because of how SESBackend works. The verifing emails is handled:
https://github.com/spulec/moto/blob/9894e1785a610f1dd8c9bfce1fa416692b3e0c2f/moto/ses/models.py#L113-L115

But when it checks sender email, it uses:
https://github.com/spulec/moto/blob/9894e1785a610f1dd8c9bfce1fa416692b3e0c2f/moto/ses/models.py#L102-L107

where `addresses` is filled by `verify_email_identity` only.



Discussion:

Resolving patch:
diff --git a/moto/ses/models.py b/moto/ses/models.py
--- a/moto/ses/models.py
+++ b/moto/ses/models.py
@@ -103,6 +103,8 @@ def _is_verified_address(self, source):
         _, address = parseaddr(source)
         if address in self.addresses:
             return True
+        if address in self.email_addresses:
+            return True
         user, host = address.split("@", 1)
         return host in self.domains
 


Test patch:
diff --git a/tests/test_ses/test_ses_boto3.py b/tests/test_ses/test_ses_boto3.py
--- a/tests/test_ses/test_ses_boto3.py
+++ b/tests/test_ses/test_ses_boto3.py
@@ -84,6 +84,35 @@ def test_send_email():
     sent_count.should.equal(3)
 
 
+@mock_ses
+def test_send_email_when_verify_source():
+    conn = boto3.client("ses", region_name="us-east-1")
+
+    kwargs = dict(
+        Destination={"ToAddresses": ["test_to@example.com"],},
+        Message={
+            "Subject": {"Data": "test subject"},
+            "Body": {"Text": {"Data": "test body"}},
+        },
+    )
+
+    conn.send_email.when.called_with(
+        Source="verify_email_address@example.com", **kwargs
+    ).should.throw(ClientError)
+    conn.verify_email_address(EmailAddress="verify_email_address@example.com")
+    conn.send_email(Source="verify_email_address@example.com", **kwargs)
+
+    conn.send_email.when.called_with(
+        Source="verify_email_identity@example.com", **kwargs
+    ).should.throw(ClientError)
+    conn.verify_email_identity(EmailAddress="verify_email_identity@example.com")
+    conn.send_email(Source="verify_email_identity@example.com", **kwargs)
+
+    send_quota = conn.get_send_quota()
+    sent_count = int(send_quota["SentLast24Hours"])
+    sent_count.should.equal(2)
+
+
 @mock_ses
 def test_send_templated_email():
     conn = boto3.client("ses", region_name="us-east-1")