SMTP question

L

LutherRevisited

I'm trying to send an email this way:
msg = MIMEText(self.text_ctrl_1.GetValue())
msg['Subject'] = sub
msg['From'] = '(e-mail address removed)'
msg['To'] = to
s = smtplib.SMTP('smtp.mail.yahoo.com')
s.set_debuglevel(1)
s.connect()
s.sendmail('(e-mail address removed)', to, msg)
s.quit()
but this is not working at all. Can someone point me in the right direction?
 
J

Josiah Carlson

I'm trying to send an email this way:
msg = MIMEText(self.text_ctrl_1.GetValue())
msg['Subject'] = sub
msg['From'] = '(e-mail address removed)'
msg['To'] = to
s = smtplib.SMTP('smtp.mail.yahoo.com')
s.set_debuglevel(1)
s.connect()
s.sendmail('(e-mail address removed)', to, msg)
s.quit()

smtplib.SMTP.sendmail takes:
(sender, [recipient1, recipient2,...], message)

Make the second to the last line:
s.sendmail('(e-mail address removed)', [to], msg)

And it should work (if you are allowed to send outgoing through
smtp.mail.yahoo.com)

You should also call s.close(), just to be sure.

- Josiah
 
L

LutherRevisited

To Josiah, sorry you're getting this twice, didn't realize you responded both
in the mailgroup, and by email. But to others, that didn't help, well, it did
as far as me formating for a list, but I'm still not getting into Yahoo. For
my smtp server smtp.mail.yahoo.com, I just pasted directly from my Outlook
settings which have always worked fine. When I use s.login('bossierbossman',
'password') I get something like SMTP AUTH extension not supported by server,
and when I just have s.connect() I get socket.error: (10061, 'Connection
refused')
 
G

Gilles Lenfant

LutherRevisited a écrit :
I'm trying to send an email this way:
msg = MIMEText(self.text_ctrl_1.GetValue())
msg['Subject'] = sub
msg['From'] = '(e-mail address removed)'
msg['To'] = to
s = smtplib.SMTP('smtp.mail.yahoo.com')
s.set_debuglevel(1)
s.connect()
s.sendmail('(e-mail address removed)', to, msg)
s.quit()
but this is not working at all. Can someone point me in the right direction?

Have a look at the email package that provides features for building
easily RFC822 compliant mail headers and bodies (including multipart).
 
L

Lad

To Josiah, sorry you're getting this twice, didn't realize you responded both
in the mailgroup, and by email. But to others, that didn't help, well, it did
as far as me formating for a list, but I'm still not getting into Yahoo. For
my smtp server smtp.mail.yahoo.com, I just pasted directly from my Outlook
settings which have always worked fine. When I use s.login('bossierbossman',
'password') I get something like SMTP AUTH extension not supported by server,
and when I just have s.connect() I get socket.error: (10061, 'Connection
refused')

I also had a problem to find a mail server that could relay my emails.
So I do it this way: for a recepient's address I find his mailserver
and send the email directly to it. No need to have a mail server
LAd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top