Amazon EC2/SES SMTP Timeout

后端 未结 3 987
情深已故
情深已故 2020-12-14 00:47

I have an issue when trying to send emails from my EC2 instance using SMTP to SES. For some reason I am getting sporadic timeout issues, where I can no longer contact the S

3条回答
  •  春和景丽
    2020-12-14 01:26

    If you're running a Django app and suspect Steffen's answer might be the cause - here is a quick litmus test:

    In [1]: from django.core.mail.backends.smtp import EmailBackend
    In [2]: from django.core.mail import EmailMultiAlternatives
    In [3]: message = EmailMultiAlternatives(
       ...:     subject='testing the rate limit',
       ...:     body='this is a test',
       ...:     to=['your+email@example.com'],
       ...:     from_email='from@example.com',
       ...: )
    In [4]: backend_587 = EmailBackend(port=587)
    In [5]: backend_25 = EmailBackend(port=25)
    In [6]: backend_587.send_messages([message])
    Out[6]: 1
    In [7]: backend_25.send_messages([message])  # hangs for a long time. Might even timeout
    

    Sending the email from port 25 should hang. Sending the email from 587 should send quickly.

提交回复
热议问题