I am new in Raspberry Pi and I am trying to send mails without using SMTP. I had used SMTP before and it worked perfectly fine. But recently the same code is not working, though it compiles without any error. I have added the error message below. I want to know are there any ways besides SMTP?

Error Message

  • 1
    While I'm not a python user, it may be worth noting that a library and what it implements are not synonymous. So while as stevieb points out sending email == using SMTP, using SMTP != using smtplib.
    – goldilocks
    Nov 14, 2019 at 15:08

2 Answers 2


SMTP, or Simple Mail Transport Protocol is the mail delivery mechanism in use currently on the Internet.

You can't send email without using SMTP in one way or another, either directly, or via a script or program that accesses a tool (for example an API or email-based website) that ties directly with SMTP on its back end.

  • Okay, now let me explain the main problem. I have used smtplib before without any issue. But recently the same code is not working. The code do compile without any error but it shows Network Unreachable issue. Previously many people posted this issue but no clear solution is not available.
    – opu 웃
    Nov 15, 2019 at 14:59
  • @opu웃 You should edit your question to add this new information. Many people don't read comments thoroughly and may miss this information.
    – stevieb
    Nov 15, 2019 at 16:18
  • I have edited the question. Thank you for the suggestion.
    – opu 웃
    Nov 16, 2019 at 10:18

You don't say what OS or list any code, but do tag ssmtp which is deprecated in Buster and hasn't been updated in years.

There are replacements. I use msmtp (although not Python). See https://raspberrypi.stackexchange.com/a/100704/8697

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.