Having read other answers on here, I know that shell=True
is frowned upon, but I am having trouble with a command (more accurately a pair of commands?) with a pipe redirect.
This works:
subprocess.call('echo "Test" | mail -s "Test" test@gmail.com', shell=True)
but this does not:
subprocess.call(["echo", "Test", "|", "mail", "-s", "'Test'", test@gmail.com"]))
Any suggestions on how to make the second one work?