sendmail - How to find out why Python send_message() isn't working -
I am calling send_message ()
in a Python script, but it does not work for it Does some reason I currently have the following:
Try: print "send message" s.send_message (msg) print except "Message Sent" (SMTPRecipientRefused, SMTPHeloError, SMTPSenderRefused, SMTPDataError) e: Print E
Now running it, sending a message
is printed, but nothing else. There is no exception description, and sent messages
are never printed. I know how the problem is with the send_message ()
function? What would a common exception handler help? I have tried returning the return code or the boolean to send_message ()
, but I have not got anything, any suggestions as a way to track the problem will be greatly appreciated!
"print message" is not displayed because s.send_message () is a blocked call. In other words, "Message sent" will not print unless sent_message () func does not end. Try to time out while making the SMTP object (I'm assuming using that script) and then when your send_message fails, you can catch exceptions. But in the meantime, make sure your host IP / port is correct.
Comments
Post a Comment