python - SMTP library: Dynamic email content -


i have sendmail() method uses smtp send out emails.

def sendmail(toaddrs, msg):      # set credentials     username = auto_email_username     password = auto_email_password      print "message received in send mail message: " + msg      # sending mail using google smtp server     server = smtplib.smtp('smtp.gmail.com:587')     server.starttls()     server.login(username,password)     try:         server.sendmail(username, toaddrs, msg.as_string())     except:         server.sendmail(username, toaddrs, msg)     server.quit() 

it accepts list of emails (toaddrs) , sends message receives (msg) emails. call method inside django view.

now what's happening here is, whenever message sent dynamic content, concatenated string, empty emails. idea why happening?

the print statement prints proper concatenated string method receives emails empty.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -