Python Email script trouble -


i have script running nightly. want send me email when fails complete. wrote short test script learn how send email python. in ide runs without error messages no email. i'm running 1 of our servers (not email server) doesn't have email restrictions.

i tried in python shell can read messages:

screen capture of shell

i tried sending gmail account , error:

smtprecipientsrefused: {'blahblahblah@gmail.com': (550, '5.7.1 unable relay')}

any ideas??

more info:

i modified code found here work our email.

def send_email(user, recipient, subject, body):     import smtplib      = user     = recipient if type(recipient) list else [recipient]     subject = subject     text = body      # prepare actual message     message = """\from: %s\nto: %s\nsubject: %s\n\n%s     """ % (from, ", ".join(to), subject, text)     try:         server = smtplib.smtp("workemailserver.com")         server.sendmail(from, to, message)         server.close()         print 'successfully sent mail'     except:         print "failed send mail" 

with can send email coworkers, not myself. no biggie because can use coworkers email sender. our "email server" relays messages office365, that's why cant send gmail.

my problem solved. never able "simpler" code on top work when had tried sending coworkers?

smtprecipientsrefused: (550, '5.7.1 unable relay')

this means server used can not relay message target recipient. happens when email server has configuration issues.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -