New to using mime within a python email...
https://www.smallsurething.com/multi-line-strings-in-python/ : this guy provides a couple of ways to create a multi-line string, but I can't seem to convince mime to use it in the body of an email.
body <SPAN class="operator token">=</SPAN> <SPAN class="string token">"""first line
second line
final line"""</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>body<SPAN class="punctuation token">)</SPAN>
first line
second line
final line
<SPAN class="comment token"># I use it in mime like this:</SPAN>
msg <SPAN class="operator token">=</SPAN> MIMEMultipart<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
msg<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"From"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> emailfrom
msg<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"To"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> COMMASPACE<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>emailto<SPAN class="punctuation token">)</SPAN>
msg<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"Subject"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Please see attached xls for errors"</SPAN>
body <SPAN class="operator token">=</SPAN> <SPAN class="string token">"""OriginObjectID & DestinationObjectID are the two lines in the error
RuleDescription is what rule has been broken
Name should be self-explanatory"""</SPAN>
msg<SPAN class="punctuation token">.</SPAN>attach<SPAN class="punctuation token">(</SPAN>MIMEText<SPAN class="punctuation token">(</SPAN>body<SPAN class="punctuation token">,</SPAN><SPAN class="string token">'plain'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
As shown in lines 6-8, this approach produces an indent that I'd like to avoid.
template <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="string token">"This is the first line.\n"</SPAN>
<SPAN class="string token">"This is the second line.\n"</SPAN>
<SPAN class="string token">"This is the third line."</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>template<SPAN class="punctuation token">)</SPAN>
This <SPAN class="keyword token">is</SPAN> the first line<SPAN class="punctuation token">.</SPAN>
This <SPAN class="keyword token">is</SPAN> the second line<SPAN class="punctuation token">.</SPAN>
This <SPAN class="keyword token">is</SPAN> the third line<SPAN class="punctuation token">.</SPAN>
msg <SPAN class="operator token">=</SPAN> MIMEMultipart<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
msg<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"From"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> emailfrom
msg<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"To"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> COMMASPACE<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>emailto<SPAN class="punctuation token">)</SPAN>
msg<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"Subject"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Please see attached xls for errors"</SPAN>
body <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="string token">"OriginObjectID & DestinationObjectID are the two lines in the error\n"</SPAN>
<SPAN class="string token">"RuleDescription is what rule has been broken\n"</SPAN>
<SPAN class="string token">"Name should be self-explanatory"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Is what I'd like to use, and it works great from the command line but when I use it mime, the newlines are ignored so the body of my email is one long run-on sentence. What's the secret to get a nice looking, multi line mime-email body?