Below is my code which sends a mail to my users:
mail = EmailMultiAlternatives(subject=subject, body=text_content, from_email="email@host.com", to=["email@host.com"], bcc=["email@host.com"])
mail.attach_file(model.document.path)
mail.attach_alternative(html_content, "text/html")
mail_status = mail.send()
And my settings.py
is as below:
EMAIL_HOST = "mail.host.com"
EMAIL_PORT = 587
EMAIL_HOST_USER = "email@host.com"
EMAIL_HOST_PASSWORD = str(os.getenv('EMAIL_HOST_PASSWORD'))
The problem is that the above code works absolutely fine in my local Windows machine but the code hangs and shows no output when running in my remote server running Ubuntu (Linux).
Any idea where I am going wrong?