I am trying to make a script that sends a email. But how to do line breaks? I tried the following:
Change msg = MIMEText(msginp)
to msg=MIMEText(msginp,_subtype='plain',_charset='windows-1255')
NOTE: msginp is a input (
msginp = input('Body? ')
)
Does anybody know how to make line breaks? Like the enter
key on your keyboard?
My code is:
import smtplib
from email.mime.text import MIMEText
import getpass
smtpserverinp = input('What SMTP server are you using? (Look here for more information. https://sites.google.com/view/smtpserver) ')
usern = input('What is your email adderess? ')
p = getpass.getpass(prompt='What is your password? (You will not see that you are typing because it is a password) ')
subjectss = input('Subject? ')
msginp = input('Body? ')
toaddr = input('To who do you want to send it to? ')
msg = MIMEText(msginp)
msg['Subject'] = subjectss
msg['From'] = usern
msg['To'] = toaddr
s = smtplib.SMTP(smtpserverinp, 587)
s.starttls()
s.login(usern, p)
s.sendmail(usern, toaddr, msg.as_string())
s.quit()
Thanks!