Most popular tags

Welcome to, where you can ask questions and receive answers from other members of the community.

Sending text messages from Raspberry Pi via email fails

I'm using mailx on my raspberry pi to try to send text messages updates for event monitoring.

  • My phone number:9876543210
  • My phone's email-to-text gateway address:

I can

  1. Send emails from my raspberry pi to various email addresses. mail -r -s "My Subject" < body.txt and off it goes and is successfully delivered.

  2. Send emails from various email address (not on RPi) using mailx to the above phone-email address and have them delivered as text messages.

However, when sending emails to from the Raspberry Pi using mailx the emails seem to spiral into the void and are never heard of again (no errors, no undeliverable messages, nothing). Does anyone know what could be causing this to go awry? Something about the basic deployment of the mail server on the pi?


Based on @kobaltz's suggestion, I used sendmail instead. This led to a hang, then an error that stated that I lacked a fully qualified domain name (FQDN). I then used this website's instructions to add a domain name to the RPi. To paraphrase:

I have set the FQDN in  /etc/hostname:

and /etc/hosts: localhost.localdomain localhost my-host-name

Then add to /etc/mail/

I put this in /etc/mail/, BEFORE the MAILER() lines, ran sendmailconfig, answered Yes to the questions about using the existing files, and restarted sendmail. Emails now have the proper domain name.

Progress, however, I am now stuck at the following error:

354 Enter mail, end with "." on a line by itself
>>> .
050 <>... Connecting to via esmtp...
050 421 Service not available
050 >>> QUIT
050 <>... Deferred: 421 Service not available
250 2.0.0 q9U3ZESt021150 Message accepted for delivery Sent (q9U3ZESt021150 Message accepted for delivery)
Closing connection to []
>>> QUIT

1 Answer