sendmail fails with oleane smtp server

A forum for general discussion of the Python programming language.

sendmail fails with oleane smtp server

Postby jadawin_fr » Fri Oct 18, 2013 7:46 am

hi,

newbie in python (2.75) and no mail specialist, I would like to send e-mails from a python script under windows.


After looking for howtos and tutorials et trying some commands, here I am :
Code: Select all
import smtplib
sender = 'de@wanadoo.fr'
receivers = ['freg@voila.fr']
message = """From: From Elle<de@wanadoo.fr>
To: To Moi <freg@voila.fr>
Subject: test SMTP

C un test d'envoi de message.
"""
smtpObj = smtplib.SMTP('smtp.fr.oleane.com:587')
smtpObj.ehlo()

(250, 'smtp04.msg.oleane.net Hello [62.160.44.188], pleased to meet you\nENHANCEDSTATUSCODES\nPIPELINING\n8BITMIME\nSIZE 21000000\nDSN\nAUTH PLAIN LOGIN\nDELIVERBY\nHELP')
Code: Select all
smtpObj.login('user', 'pwp')

(235, '2.0.0 OK Authenticated')

Code: Select all
smtpObj.sendmail(sender, receivers, message)

Traceback (most recent call last):
File "<pyshell#73>", line 1, in <module>
smtpObj.sendmail(sender, receivers, message)
File "C:\Python27\lib\smtplib.py", line 720, in sendmail
(code, resp) = self.mail(from_addr, esmtp_opts)
File "C:\Python27\lib\smtplib.py", line 473, in mail
return self.getreply()
File "C:\Python27\lib\smtplib.py", line 362, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
SMTPServerDisconnected: Connection unexpectedly closed



I've made a test with an outlook address (smtp.live.com) and it worked fine adding between 'ehlo' and 'login' : 'starttls'. Trying with oleane, I've got an error :
Code: Select all
smtpObj.starttls()

Traceback (most recent call last):
File "<pyshell#56>", line 1, in <module>
smtpObj.starttls()
File "C:\Python27\lib\smtplib.py", line 636, in starttls
raise SMTPException("STARTTLS extension not supported by server.")
SMTPException: STARTTLS extension not supported by server.


An idea?
Last edited by Mekire on Fri Oct 18, 2013 7:53 am, edited 1 time in total.
Reason: First post lock.
jadawin_fr
 
Posts: 3
Joined: Fri Oct 18, 2013 7:23 am

Re: sendmail fails with oleane smtp server

Postby jadawin_fr » Tue Oct 22, 2013 6:19 am

:oops:
without login, I'm able to send messages.
jadawin_fr
 
Posts: 3
Joined: Fri Oct 18, 2013 7:23 am


Return to General Discussions

Who is online

Users browsing this forum: alex55555 and 4 guests