A Digital Age Deserves A Digital Leader

Python Email send script

Python Email send script

Postby DEVILSAN » Wed Jan 14, 2009 6:19 pm

Hi I am trying to make python program to send email. I am modeling in Autodesk maya software and i want when the render of my model is complete it should email me the log, i hav scripted till when to send email and prepare a log but this python script doesnt seems to work out fine

Autodesk Maya supports Maya embedded language and Python for scripting inside it

Code: Select all
import smtplib


AUTHREQUIRED = 1 # if you need to use SMTP AUTH set to 1
smtpuser = 'user@gmail.com'  # for SMTP AUTH, set SMTP username here
smtppass = 'mypass'  # for SMTP AUTH, set SMTP password here

RECIPIENTS = ['tomyself@gmail.com']
SENDER = 'san@skvfx.com'
mssg = open('C:/Documents and Settings/san/Desktop/render.log', 'r').read()

session = smtplib.SMTP('smtp.gmail.com', 465)

if AUTHREQUIRED:
    session.login(smtpuser, smtppass)
smtpresult = session.sendmail(SENDER, RECIPIENTS, mssg)

if smtpresult:
    errstr = ""
    for recip in smtpresult.keys():
        errstr = """Could not delivery mail to: %s

Server said: %s
%s

%s""" % (recip, smtpresult[recip][0], smtpresult[recip][1], errstr)
    raise smtplib.SMTPException, errstr
PRO Level 13
User avatar
Posts: 751
Joined: Sat Oct 18, 2003 6:17 pm
Location: Canada
Real Name: san luthra

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 3 guests

cron
cron