473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Gmail without TLS

On this site, someone said that to send a message over smtp gmail, you didnt need tls. im working with a port of python with basically supports everything but https, ssl, tls so libgmail, etc doesnt work. i have found a way to get my mail without those things(via gmail atom feeds) but i need a way to send messages.

this is the code that i am working with (gmailer):

Expand|Select|Wrap|Line Numbers
  1. import smtplib
  2.  
  3. class Gmailer:
  4.     """
  5.     Send email through Gmail.
  6.  
  7.     use: Gmailer(user, password[, host])
  8.     use: send(to_addrs, subject, message[, from_addrs])
  9.     """
  10.     host='smtp.gmail.com'
  11.  
  12.     def __init__(self, user, password, host=None):
  13.         """
  14.         Set Google username and passsword.
  15.  
  16.         use: Gmailer(user, password[, host])
  17.         """
  18.         self.user=user
  19.         self.password=password
  20.         if host: self.host=host
  21.  
  22.     def send(self, to_addrs, subject, message, from_addr=None):
  23.         """
  24.         Set username and passsword
  25.  
  26.         use: send(to_addrs, subject, message[, from_addrs])
  27.         """
  28.         if not from_addr: from_addr=self.user
  29.         data = "From: %s\nTo: %s\nSubject: %s\n\n%s" \
  30.                     % (from_addr, to_addrs, subject, message)
  31.         try:
  32.             server=smtplib.SMTP(self.host)
  33.             server.ehlo()
  34.             server.starttls()
  35.             server.ehlo() # This must be done before and after starttls().
  36.             server.login(self.user, self.password)
  37.             server.sendmail(from_addr, to_addrs, data)
  38.         except: raise
  39.         try: server.quit() # This always fails and can safely be ignored.
  40.         except: pass
  41. mail = Gmailer('user@gmail.com', 'mypass')
  42. try:
  43.     mail.send('test@example.com', 'My Subject', 'This is my body!')
  44.     mail.send('test@example.net;test@example.org', 'My Subject', 'This is my body!')
  45. except:
  46.     print "Failed."
  47.  
if i comment out the underlined parts, it doesnt not work. any hints?
Jul 2 '07 #1
0 1872

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: Barman Brakjoller | last post by:
Just curious, what techniques does gmail leverage to hide the javascript code that their service uses to work? I've tried View Source here and there in the page without much luck. I have no...
12
by: Stanley | last post by:
Hi, I'd like to write a HTML page which can help me directly log in my Yahoo!mail or Gmail account without typing user name and password. Basically, I want to set up a link, click it and pop up...
10
by: nkimmigration | last post by:
Can someone please spare a GMAIL Invitation for me. Thank you for the generocity, -..
6
by: Can Uzun | last post by:
Hi; sorry if this is a re-post. My question is basically this... When you receive an email and you already have a GMail page open, it shows you the new mail without refreshing (or it does that...
5
by: allan.young | last post by:
Hi, When in gmail I'm composing a new email message and I bit the browser back button, I get a dialog that says "Your message has not been sent. Discard your message?" But if instead of...
3
by: Pratik Patel | last post by:
Hello I have html generated code. like <table><tr><td><img src="http://www.abc.com/images/abc.jpg"></td></ tr></table> When i copy above code and paste this code in gmail,yahoo or hotmail
0
by: Roger | last post by:
I am having a problem sending email through smtp.gmail.com using smtplib. Everything works and the mail is sent and received, except quit. The following shows the problem (without bothering to...
2
by: Cirene | last post by:
I want to make an application that checks messages (including message attributes, like From/To, Subject, Body, Date). Any suggestions? I couldn't find an official GMail web service or API. ...
2
by: Luis | last post by:
Hello, My work involves creating HTML emails for marketing. Recently I've noticed that whenever I write a url on the body of an HTML email without linking it (e.g., mycompany.org), Gmail creates...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.