Is it possible to send an email directly from my computer to a Hotmail or Gmail (or any other) recipient, without connecting to a third-party sending server (SMTP)?
i.e. would it be possible that my computer directly connects to gmail.com if the recipient is example@gmail.com, etc.
I tried this:
import smtplib
def mailsend(FROM, TO, SUBJECT, TEXT):
message = "From: %s\nTo: %s\nSubject: %s\n%s" % (FROM, TO, SUBJECT, TEXT)
server = smtplib.SMTP('localhost')
server.sendmail(FROM, TO, message)
server.quit()
mailsend("test@example.com", "example@gmail.com", "Hello", "First email")
but I get
Errno 10061 : No connection could be made because the target machine...
(the reason is probably that localhost
doesn't have any email-sending server, but my question is: is it possible to send emails without such an email-sending server, but directly to the recipient's server?)
How to do a "direct-to-MX" mail in Python? (as described here)
Notes:
I'm running it from Windows, I don't have a local SMTP / Sendmail / Postfix.
I know it's usually a bad idea to do this (the recipient will very likely reject the email I send, because I don't have any DKIM, SPF, etc.), and I do know that it's a very difficult task to run a good-delivery-rate mail server, but I just wanted to know if, technically, it's possible