Closed shenghaomail closed 5 years ago
There's a separation of content between each element in contents.
If you want you could just do , contents=body + html
, that should avoid the blank line?
thank you for reply!
Test the following three commands, and the execution results contain blank lines.
yag.send(to=to, subject=subject, contents=[body, html])
yag.send(to=to, subject=subject, contents=body + html)
yag.send(to=to, subject=subject, contents=html)
Newlines are converted to
as a matter of convenience.
You can avoid this using html = html.replace("\n", "")
Thank you! blank lines is gone
Note that there is also a possibility now to add yag.send(contents="test\ntest", newline_to_break=False)
, that could also help.
here is my script to send mail
html = """\
<table width="500" border="2" bordercolor="red" cellspacing="2">
<tr>
<td><strong>action</strong></td>
<td><strong>total</strong></td>
<td><strong>action</strong></td>
<td><strong>pre</strong></td>
<td><strong>unsure</strong></td>
</tr>
<tr>
<td>node</a></td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</table>
"""
to = 'abc@abc.com'
subject = 'This is obviously the subject'
body = 'This is obviously the body'
yag = SMTP_SSL(user = yag_user, password = yag_password, host = yag_host,port = yag_port)
yag.send(to=to, subject=subject, contents=[body, html])
and there is some blank line between
body
andhtml