[Tutor] How to send email from a gmail a/c using smtp when port 587(smtp) is blocked
ashish.makani at gmail.com
Tue Sep 11 23:44:08 CEST 2012
some more context so people presume we are spammers :)
These emails are automated diagnostic emails sent to a group of a few
admins, so we get notified when a python heartbeat script, detects a
failure in things like n/w connectivity, router status, etc.
We dont use university email, we use gmail.
Please don't presume people's intentions (that we are sending spam) & judge
people without knowing anything about them.
We are a tiny startup trying to connect rural communities using voice & ivr
systems - http://gramvaani.org/
On Wed, Sep 12, 2012 at 2:56 AM, Emile van Sebille <emile at fenx.com> wrote:
> On 9/11/2012 2:19 PM ashish makani said...
>> Hi Python Tutor folks
>> I am stuck with an issue, so am coming to the Pythonistas who rescue me
>> everytime :)
>> I am trying to send out email programmatically, from a gmail a/c, using
>> smtplib, using the following chunk of code (b/w [ & ] below)
>> import smtplib
>> from email.mime.text import MIMEText
>> #uname, pwd are username & password of gmail a/c i am trying to send from
>> server = smtplib.SMTP('smtp.gmail.com:**587 <http://smtp.gmail.com:587> <
>> server.starttls() # get response(220, '2.0.0 Ready to start TLS')
>> server.login(uname,pwd) # get response(235, '2.7.0 Accepted')
>> toaddrs = ['x at gmail.com <mailto:x at gmail.com>', 'y at gmail.com
>> <mailto:y at gmail.com>' ] # list of To email addresses
>> msg = MIMEText('email body')
>> msg['Subject'] = 'email subject'
>> server.sendmail(fromaddr, toaddrs, msg.as_string())
>> The code above works perfectly fine on my local machine, but fails on
>> the production server at the university where i work( all ports other
>> than port 80 are blocked) :(
> Good -- the university is taking steps to block spam.
> You should send mail using the university mail system and not
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor