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 sent. For example postfix returns the following message after a mail has been queueed:
reply: '250 2.0.0 Ok: queued as EB83821273B
'
reply: retcode (250); Msg: 2.0.0 Ok: queued as EB83821273B
data: (250, '2.0.0 Ok: queued as EB83821273B')
What I am really interested is the error code (250) and the queue id (EB83821273B). I can print these if I set set_debuglevel(1), but I need to capture this in a variable for further logging and processing.
thanks and regards,
raj
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…