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): - import smtplib
-
-
class Gmailer:
-
"""
-
Send email through Gmail.
-
-
use: Gmailer(user, password[, host])
-
use: send(to_addrs, subject, message[, from_addrs])
-
"""
-
host='smtp.gmail.com'
-
-
def __init__(self, user, password, host=None):
-
"""
-
Set Google username and passsword.
-
-
use: Gmailer(user, password[, host])
-
"""
-
self.user=user
-
self.password=password
-
if host: self.host=host
-
-
def send(self, to_addrs, subject, message, from_addr=None):
-
"""
-
Set username and passsword
-
-
use: send(to_addrs, subject, message[, from_addrs])
-
"""
-
if not from_addr: from_addr=self.user
-
data = "From: %s\nTo: %s\nSubject: %s\n\n%s" \
-
% (from_addr, to_addrs, subject, message)
-
try:
-
server=smtplib.SMTP(self.host)
- server.ehlo()
-
server.starttls()
-
server.ehlo() # This must be done before and after starttls().
-
server.login(self.user, self.password)
-
server.sendmail(from_addr, to_addrs, data)
-
except: raise
-
try: server.quit() # This always fails and can safely be ignored.
-
except: pass
-
mail = Gmailer('user@gmail.com', 'mypass')
-
try:
-
mail.send('test@example.com', 'My Subject', 'This is my body!')
-
mail.send('test@example.net;test@example.org', 'My Subject', 'This is my body!')
-
except:
-
print "Failed."
-
if i comment out the underlined parts, it doesnt not work. any hints?
0 1872 Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
by: nkimmigration |
last post by:
Can someone please spare a GMAIL Invitation for me.
Thank you for the generocity,
-..
|
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...
|
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...
|
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
|
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...
|
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.
...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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,...
| |