Hi there, I'd like to know if is there a way to check my e-mail and send e-mails with python. I am trying to do that in Window Vista, and I've tried some codes with smtp, but I couldn't find a solution.

Can anyone help me out with this, thanks Dan08.

Recommended Answers

All 14 Replies

Yup. smtplib is what you want. Just search this forum and you'll find boat loads of solutions.

Hello again, I found something in gmail, and I've created a small program to send mails.
But I would like to know if is there a way where I can use hotmail insteed of gmail.
I tried to put it working with hotmail, because I thought gmail and hotmail were similar, but after I realise that I could do it, I made a research, and I found this:
http://www.emailaddressmanager.com/tips/mail-settings.html.

Cheers Dan08.

No way, was that a spammer? That was way slick. Had me fooled.

I think the problem is connecting to server, because the program just stops when it tries to connect to smtp.live.com on port 25 or 995.
Any ideas how to put it working?

What error does it give when the program "just stops"

This is the error:

Traceback (most recent call last):
  File "C:\Python26\hotmailSender.py", line 11, in <module>
    s.login(user, password)
  File "C:\Python26\lib\smtplib.py", line 552, in login
    raise SMTPException("SMTP AUTH extension not supported by server.")
SMTPException: SMTP AUTH extension not supported by server.

Any ideas? Thanks Dan08.

This is the error:

Traceback (most recent call last):
  File "C:\Python26\hotmailSender.py", line 11, in <module>
    s.login(user, password)
  File "C:\Python26\lib\smtplib.py", line 552, in login
    raise SMTPException("SMTP AUTH extension not supported by server.")
SMTPException: SMTP AUTH extension not supported by server.

Any ideas? Thanks Dan08.

The server you're attempting to connect to must not be hotmail's SMTP server. It's possible that you're connecting to the wrong port. Or the wrong server in general.

The server you're attempting to connect to must not be hotmail's SMTP server. It's possible that you're connecting to the wrong port. Or the wrong server in general.

This is my code:

import time
import smtplib

print("Welcome to EMail Sender")
print("Connecting To Hotmail... ")
s = smtplib.SMTP('smtp.live.com', 587)
user = str(raw_input("(Hotmail) User: "))
password = str(raw_input("Password: "))
recipient = str(raw_input("Recipient: "))
message = str(raw_input("Message: "))
s.connect('mail.live.com')
s.login(user, password)
s.sendmail(user,
           recipient,
           message)
s.quit()
print("E-Mail Sent")
time.sleep(4)

Can anyone please tell me whats wrong with that, Thanks Dan08.

Ive already been in that website, but i couldnt find the solution because i didnt understand, can anyone explain to me want this means:

Outgoing Server Authentication: Yes (On – Use POP username and password or Hotmail credentials) <- I think ive done this one.
Outgoing Server TLS or SSL Secure Encrypted Connection: Yes (On or Required) <- How do i do it?

Thanks, Dan08.

Ok I'm leaving for now but, some servers support SSL some dont. So setting SSL on for server that doesn't support, will lead to failure to login and hence will not do the necessary. See you tomorrow :)

This post might help you on server settings
http://www.mydigitallife.info/2009/01/16/hotmail-free-pop3-and-smtp-access-and-server-configuration-settings/

In http://www.mydigitallife.info/2009/01/16/hotmail-free-pop3-and-smtp-access-and-server-configuration-settings/, it says there that "Outgoing Server Authentication: Yes", so i must use username and password, and ive included it in my program, and then it says "Outgoing Server TLS or SSL Secure Encrypted Connection: Yes", but first of all, ive already tried to add something like this:

s = smtplib.SMTP_SSL('smtp.live.com', 587)

But appeared the following error:

Traceback (most recent call last):
File "C:\Python26\hotmailSender.py", line 12, in <module>
s.login(user, password)
File "C:\Python26\lib\smtplib.py", line 552, in login
raise SMTPException("SMTP AUTH extension not supported by server.")
SMTPException: SMTP AUTH extension not supported by server.

Ive tried million of thing in my program, but i really dont know how to put it working, ive done it well with gmail, and i didnt get, why is so hard to put it working with hotmail.

All help is appreciated, Dan08.

Hi everyone again, ive seen in http://ubuntuforums.org/archive/index.php/t-1139966.html, that B4RR13N705, added to his program server.starttls(), and actually in http://www.mydigitallife.info/2009/01/16/hotmail-free-pop3-and-smtp-access-and-server-configuration-settings/, it says that we need to use a TLS or SSL Secure Encrypted Connection, so i tried to add it to my program, but an error occured:

Traceback (most recent call last):
  File "C:\Python26\hotmailSender.py", line 13, in <module>
    s.starttls()
  File "C:\Python26\lib\smtplib.py", line 611, in starttls
    raise SMTPException("STARTTLS extension not supported by server.")
SMTPException: STARTTLS extension not supported by server.

Does anyone know what does it mean? Dan08.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.