I am trying to send a mail via python's subprocess.run methode. Unfortunately, it is not working.
import subprocess
message = "Hello World"
process = subprocess.run(["mail", "-s", "Test, "xyz@xyz.com", "<<<", message],
stdout=subprocess.PIPE,
universal_newlines=True)
print (process.stdout)
I received the following Error:
mail: Cannot parse address <<<' (while expanding
<<<'): Malformed email address
mail: Cannot parse address Hello World' (while expanding
Hello World'): Malformed email address
The command is working in the shell though (Linux Mint > 19.0).