Ich wollte mich auch mal ans Email versenden wagen.
Leider habe ich keinen lokalen SMTP-Server.
Aber theoretisch kann ich mich doch auch direkt mit einem Mail Anbieter (web.de, yahoo.de) verbinden oder?
Also ich habe es jetzt so versucht:
- simplemail
Code: Alles auswählen
from simplemail import Email
email = Email(
smtp_server = 'smtp.web.de',
smtp_user = 'xxxxx',
smtp_password = 'xxxx',
from_address = 'xxxxxxx',
to_address = 'xxxxxxx',
subject = 'foo',
message = 'bar'
).send()
-smtp-modulFile "/home/user/simplemail.py", line 526, in send
smtp.login(user = self.smtp_user, password = self.smtp_password)
File "/usr/lib/python2.4/smtplib.py", line 554, in login
raise SMTPException("SMTP AUTH extension not supported by server.")
smtplib.SMTPException: SMTP AUTH extension not supported by server.
Code: Alles auswählen
import smtplib
from email.MIMEText import MIMEText
msg = MIMEText('hack')
msg['Subject'] = 'ham'
msg['From'] = 'xxxx'
msg['To'] = 'xxxxx'
s = smtplib.SMTP()
s.connect('smtp.mail.yahoo.de')
s.login('xxxxx', 'xxxxxx')
s.sendmail(msg['From'], msg['To'], msg.as_string())
s.close()
Was ist da jetzt falsch?
Danke!
lg icepacker