'How to send emails with get_connection method in django?
I'm trying to send emails. First i am creating connection instance with get connection method. And then getting desire email host credentials from db. the connection instance is creating and all flow is going good but i am not receiving email on my email address. no error is raising..
Step one:(passing email host object in connection function)
def send_mass_html_mail_dynamic(email_object,request_data,template=None):
email_host = EmailHost.objects.if_exists(request_data["email_host"])
connection = email_connection(email_host) #here is connection function that returns connection object.
Step two:(creating connection with the credentials of email host)
def email_connection(email_host=None):
if email_host:
password = decypt(email_host.password)
print("password :",password)
print("ssl :",email_host.use_ssl)
connection = get_connection(
host=email_host.host,
username=email_host.email,
password=password,
port=email_host.port,
use_tls =email_host.use_tls,
use_ssl =email_host.use_ssl,
fail_silently=False
)
return connection
step three(send messages with connection object)
.....
messages = [message1,message2]
print("reached to connect send instance")
connection.send_messages(messages)
print("sent to all")
-->send to all is printing with no error...but im email is not receiving in my email address... I have triple checked email host credentials and also print them they are correct.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
