I'm trying to send text with multiple lines:
text = "This is a line 1
This is a line 2
This is a line 3"
in a python script with:
cmd = "echo {} | mail -s 'Test email' name@server.com".format(text)
os.system(cmd)
but I get an error because new lines are interpreted as commands:
sh: line 1: This: command not found
printing it out, it result in:
echo This is line 1
This is line 2
This is line 3 | mail -s 'Test email' name@server.com
I think the solution is simple, but I did not find any useful solution.