E
Evan
Hello -
I'm new with Python, I try to do a mail problem, the code likes below:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import smtplib
import mimetypes
from email.Encoders import encode_base64
from email.MIMEAudio import MIMEAudio
from email.MIMEBase import MIMEBase
from email.MIMEImage import MIMEImage
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
msg = MIMEMultipart()
msg['From'] = '(e-mail address removed)'
msg['To'] = '(e-mail address removed)'
msg['Subject'] = 'test subject'
body=MIMEText('hello,\r\n ok',_subtype='html',_charset='windows-1255')
msg.attach(body)
server = smtplib.SMTP('mail.xx.net')
server.sendmail('(e-mail address removed)', '(e-mail address removed)', msg.as_string())
server.quit()
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I try to use "\r\n" or "\n", but no luck, nothing with them, I still
get a Single-line text in the mail.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
hello, ok
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So how do I send a multiline mail? such as :
+++++++++++++++++++++++++++++++++++++++++++
Hello,
1,
2,
ok
+++++++++++++++++++++++++++++++++++++++++++
I would like to get help from you, thanks so much.
I'm new with Python, I try to do a mail problem, the code likes below:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import smtplib
import mimetypes
from email.Encoders import encode_base64
from email.MIMEAudio import MIMEAudio
from email.MIMEBase import MIMEBase
from email.MIMEImage import MIMEImage
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
msg = MIMEMultipart()
msg['From'] = '(e-mail address removed)'
msg['To'] = '(e-mail address removed)'
msg['Subject'] = 'test subject'
body=MIMEText('hello,\r\n ok',_subtype='html',_charset='windows-1255')
msg.attach(body)
server = smtplib.SMTP('mail.xx.net')
server.sendmail('(e-mail address removed)', '(e-mail address removed)', msg.as_string())
server.quit()
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I try to use "\r\n" or "\n", but no luck, nothing with them, I still
get a Single-line text in the mail.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
hello, ok
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So how do I send a multiline mail? such as :
+++++++++++++++++++++++++++++++++++++++++++
Hello,
1,
2,
ok
+++++++++++++++++++++++++++++++++++++++++++
I would like to get help from you, thanks so much.