Setting Return-Path in email

ragav s raxmic at gmail.com
Mon May 23 04:39:35 EDT 2016


Hi all,

How can i add different Return-path and fromid in python.i have pasted the below code for preview


def sendMail(sub,fromid,to,cc,html):
    msg = MIMEMultipart('alternative')
    msg['Subject'] = sub
    msg['From'] = fromid
    msg['To'] = to
    toaddress = [to]
    if cc:
        msg['Cc'] = cc
        toaddress = to+","+ cc
        toaddress = toaddress.split(",")

    type = 'plain'
    part = MIMEText(html, type,'utf-8')
    msg.attach(part)

    s = smtplib.SMTP('localhost')
    s.sendmail(fromid,toaddress, msg.as_string())
    s.quit()



More information about the Python-list mailing list