[Tutor] new line to list of strings send by email
Bob Gailer
bgailer at gmail.com
Fri Jan 8 12:04:00 EST 2016
On Jan 8, 2016 11:03 AM, "Emil Natan" <shlyoko at gmail.com> wrote:
>
> Hello list,
>
> I have a function which receives a string and sends it as a body of an
> email.
>
> It is a part of a program which does certain checks on network
> infrastructure. When a check fails I append error message to a
> error_collector list:
>
>
> if self.check_axfr_refused(ip):
> error_collector.append('%s:%s AXFR test for %s FAILED' %
> (ns, ip, self.domainname))
>
> At the end I send the alert like this:
>
> if len(error_collector) != 0:
> email_body = str(error_collector)
> email_alert(email_body)
Instead of str( str(error_collector) ) try '\n'.join(error_collector)
More information about the Tutor
mailing list