I am getting the above error when trying to run an automated email script. If I delete most of the body of the email it works fine. However, when I add over some number of characters (all are upper/lower case or numbers) I get the error. I tried changing the code in smtplib.py
but then my script stopped working.
This is my code:
smtpObj = smtplib.SMTP('smtp endpoint', 587)
smtpObj.ehlo()
smtpObj.starttls()
smtpObj.login('login', sys.argv[1])
for name, email in unmessagedmembers.items():
body = """Subject: Research\na {} lot of text
n more text""".format(name)
print('Sending email to {}...'.format(email))
sendmailStatus = smtpObj.sendmail('me@email.com', email, body)
if sendmailStatus != {}:
print('There was a problem sending email to {}: {}'.format(email, sendmailStatus))
smtpObj.quit()
it is saying I get the error on the line:
sendmailStatus = smtpObj.sendmail('me@email.com', email, body)