working text function

concatenated the output into a single string, then used smtplib library
for email sending