I have read plenty of links for sending emails through django. I've tried all of them but they don't work. I tried sending an email through the python shell and I get '1'. - So what are the settings that I should use for the email to work, I'm willing to use any mail server? - I was using gmail but I read that it causes problems, if I'm going to use hotmail for example do I need to specify the email password in the settings.xml? - how to debug this problem?
Best How To :
This is pure python code for sending emails using SMTP Lib
from threading import Thread
import requests
import time
import smtplib
def email_sender(input_message, email_to, client):
''' function to send email '''
to = email_to
gmail_user = 'email of sender account'
gmail_pwd = 'password of sender account'
smtpserver = smtplib.SMTP("smtp.gmail.com",587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(gmail_user, gmail_pwd)
header = 'To:' + to + '\n' + 'From: ' + gmail_user + '\n' + 'Subject:site down! \n'
input_message = input_message + client
msg = header + input_message
smtpserver.sendmail(gmail_user, to, msg)
smtpserver.close()