Most popular tags

Welcome to Earthwithsun.com, 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: [email protected]

I can

  1. Send emails from my raspberry pi to various email addresses. mail -r [email protected] -s "My Subject" [email protected] < 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 [email protected] 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?

EDIT

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: my-host-name.my-domain.com

and /etc/hosts:

127.0.0.1 localhost.localdomain localhost
192.168.0.5 my-host-name.my-domain.com my-host-name

Then add to /etc/mail/sendmail.cf:
MASQUERADE_AS(`my-domain.com')
MASQUERADE_DOMAIN(`my-host-name.my-domain.com')
FEATURE(`masquerade_entire_domain')
FEATURE(`masquerade_envelope')

I put this in /etc/mail/sendmail.cf, 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 <[email protected]>... Connecting to mxx.cingularme.com. via esmtp...
050 421 Service not available
050 >>> QUIT
050 <[email protected]>... Deferred: 421 Service not available
250 2.0.0 q9U3ZESt021150 Message accepted for delivery
[email protected].. Sent (q9U3ZESt021150 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT

1 Answer