I have a very simple piece of code that I used in previous versions of Python without problems (version 2.5 and earlier). Now with 3.0, the following code gives an error in the input line "argument 1 must be a string or a buffer, not str".
import smtplib
smtpserver = 'mail.somedomain.com'
AUTHREQUIRED = 1
smtpuser = 'admin@somedomain.com'
smtppass = 'somepassword'
msg = "Some message to send"
RECIPIENTS = ['admin@somedomain.com']
SENDER = 'someone@someotherdomain.net'
session = smtplib.SMTP(smtpserver)
if AUTHREQUIRED:
session.login(smtpuser, smtppass)
smtpresult = session.sendmail(SENDER, RECIPIENTS, msg)
Google shows that some problems with this error are not clear, but I still cannot figure out what I need to get it to work. Suggestions included the definition of the username as "username", but this also does not work.
source
share