0

I tested Django send_mail() function which I needed for a project. I had the EMAIL_HOST set to the SMTP server provider my company uses, EMAIL_PORT to 587, EMAIL_USE_TLS to True. Both EMAIL_HOST_USER and EMAIL_HOST_PASSWORD was set to "" (empty string).

Then I used the send_mail as:

from djanog.core import mail


mail.send_mail(
    "Django mail sample",
    "Body",
    "myemail@example.com",
    ["myemail@example.com"]
)

But calling the view actually sent the email to my mail from my mail, but I didn't provide any password at all. I also set recipient_list to my colleague's mail, it worked. Then I tried to change the from_email to my colleague's mail it didn't work.

I have my mail setup in Thunderbird in my system.

So how did Django sent the mail without my email's password? Was it because of my setup in Thunderbird? What happened exactly?

Update:

  1. My colleague tried the same in his system, which doesn't have any mail configured. When running the result was an SMTPRecipientsRefused.

  2. I used both my Phone's network as Hotspot and my company's Hotspot both worked. But in my colleague's system nothing worked.

  3. When setting EMAIL_USER_HOST and EMAIL_HOST_PASSWORD in my colleague's system it worked.

Alraj
  • 170
  • 9

0 Answers0