Search code examples
pythonauthenticationnetwork-programmingsmtp

Any SMTP server can send mails to any other SMTP server?


I am creating a Python program to send a confirmation email to users.

I want to send a message using the SMTP protocol. I have not deep knowledge of network and email. So I searched on Google and here, I found many questions and answers about SMTP.

I've read "Sending email from SMTP server without the need to enter password". And it says that an SMTP server at localhost which usually doesn't require any credentials. If so, can that SMTP server send mails to outside without any restriction?

If spam have SMTP server-like feature, can that spam send emails without any restriction? What is my misunderstanding?


Solution

  • Basically any SMTP server can contact any other SMTP server on Internet and try to send a message, but every normally configured SMTP server will not accept a message from Internet unless it is addressed to its local recipients. The reason is that SMTP servers must not relay email unless it comes from a trusted source. That is an important anti-spam measure.

    There is nothing technical that will prevent you from sending spam. But if it happens and somebody complains, your admin or your provider will take steps to stop it. Because if not, the whole site will be added to some spammers blacklist.