How to configure a system to send mail out to the internet?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to configure a system to send mail out to the internet?
Hi,
I need to configure a (RAID) monitoring script to be able to use the standard Linux mailing facilities to be able to notify me via sending mail to my e-mail provider.
This concerns Debian, but I'm sure this probably is very standardized. I have no need to receive mail on that server, it just has to be able to inform me if something goes wrong.
What is the easiest way to achieve this? I still have nightmares from configuring sendmail 10 years ago and never want to do that again.
notify me via sending mail to my e-mail provider.
This concerns Debian, but I'm sure this probably is very standardized.
in my experience, not.
Quote:
What is the easiest way to achieve this? I still have nightmares from configuring sendmail 10 years ago and never want to do that again.
i sympathize.
i think you will need to figure out what backend the program in question uses, then test if that works manually.
i can tell you a recent anecdote:
i tried the same thing for 'smartd' and ended up rewriting one of the example notification scripts, because my mailing program (ssmtp) needed to be fed input in a different way than the "standard"(?) 'mail' program.
in any case:
1. make sure the mailer works
2. make sure your daemon/software/whatever knows how to use it.
Whenever I have to send mail from within a script from a machine without mail-server I use bsd-mailx (also known as heirloom-mailx). It enables you to use an SMTP-server on a different machine.
Here is a simple example how to use it using Google's GMail service: https://www.systutorials.com/1411/se...g-gmails-smtp/
It is really simple and the linked tutorial should give you enough knowledge to use any SMTP-server you have access to.
i just had to climb into my machine again to adjust ssmtp's settings.
the gist is, the email has to come from a valid email address - whatever that is.
something like "root@localhost" is NOT valid.
i simply changed the settings to make ALL mail appear to be sent from the same address, the one i have with the provider i'm using as the smtp relay.
not sure i'm getting the terminology right;
assuming i have an account with xyz.com, and my address is ondoho@xyz.com.
i tell ssmtp to use smtp.xyz.com.
i set the sender to always be ondoho@xyz.com.
I was refering to that most tools will use the "mail" command to send messages and that the system can then be setup to handle that. So far, it looks like this, I configured postfix to relay and the mail command, as well as mdadm (for RAID monitoring) uses that too.
Take a look at msmtp as n MTA for sending mail. It's very simple to set up. You can configure it to send mail via your ISP's mail system.
You might find this tutorial useful. It's focused on the Mutt mail client, but it addresses sending and receiving mail as part of the larger picture. http://www.calmar.ws/mutt/
I was refering to that most tools will use the "mail" command to send messages and that the system can then be setup to handle that. So far, it looks like this, I configured postfix to relay and the mail command, as well as mdadm (for RAID monitoring) uses that too.
yes, i suspected there was a better way when i got stuck with smartd's alert emails.
at some point i'd been told that ssmtp is much lighter & easier to set up than postfix, but judging from the tutorial you linked it seems to be about the same.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.