I have used the following code to send an email as suggested in one of the post on the similar topic. But the mail has not been sent. Any suggestions?
import subprocess
recipient = '[email protected]'
subject = 'test'
body = 'testing mail through python'
def send_message(recipient, subject, body):
process = subprocess.Popen(['mail', '-s', subject, recipient],
stdin=subprocess.PIPE)
process.communicate(body)
print("sent the email")
Your function may not be called, try this code :
May works. Good luck.