SMTP question

Josiah Carlson jcarlson at uci.edu
Sun Oct 17 04:10:26 EDT 2004


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

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

Make the second to the last line:
  s.sendmail('bossierbossman at yahoo.com', [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




More information about the Python-list mailing list