How to get server reply after sending a mail using smtplib SMTP.sendmail

后端 未结 1 1111
青春惊慌失措
青春惊慌失措 2021-01-12 22:58

I have a program to send mail using python smtplib. I have the mail sending part working fine, but I also need to capture the server return message after a mail has been sen

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-12 23:19

    If you are using the sendmail method on an SMTP instance, then it will return

    a dictionary, with one entry for each recipient that was refused. Each entry contains a tuple of the SMTP error code and the accompanying error message sent by the server.

    if you use the docmd method on the same class, the it will return

    a 2-tuple composed of a numeric response code and the actual response line (multiline responses are joined into one long line.)

    0 讨论(0)
提交回复
热议问题