LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 09-23-2017, 10:26 PM   #1
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Rep: Reputation: 56
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.
 
Old 09-24-2017, 01:44 AM   #2
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237
Blog Entries: 2

Rep: Reputation: Disabled
Theres a program called Logwatch which is a system log analyzer and reporter.. Its pre-configured to report RAID, and it has a
--mailto option .E.g.
Code:
logwatch --mailto mail@domain.com --service raid --range 'between 7 days and today'
Its that easy.

Last edited by justmy2cents; 09-24-2017 at 01:55 AM.
 
Old 09-24-2017, 03:22 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by browny_amiga View Post
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.
 
Old 09-24-2017, 06:27 AM   #4
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Your email provider may not accept mail from random senders. You may need to use your ISP email server as a relay.
 
Old 09-24-2017, 08:52 AM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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.
 
1 members found this post helpful.
Old 09-24-2017, 11:18 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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.

not all providers require this, but many do.
 
Old 09-24-2017, 07:21 PM   #7
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by ondoho View Post
in my experience, not.
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.
 
Old 09-24-2017, 07:22 PM   #8
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Original Poster
Rep: Reputation: 56
I have solved it and it works now, using these instructions:

https://www.howtoforge.com/tutorial/...-a-mail-relay/

Thanks for your help!
 
Old 09-24-2017, 08:05 PM   #9
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,321
Blog Entries: 28

Rep: Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141
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/
 
Old 09-25-2017, 01:13 AM   #10
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by browny_amiga View Post
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.

does postfix run as a daemon, or on demand?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to configure send mail or postfix krishnakant1974 Red Hat 2 01-30-2012 08:14 AM
How to configure sendmail only to send mail to external mail account Nivix Linux - Newbie 2 10-23-2008 12:46 AM
can send and recieve local mail, but not mail from internet Caine101022 Linux - Software 2 09-09-2005 01:35 PM
how to configure mail client to send mail out on different pppd threads vkrishn1 Linux - Newbie 0 12-29-2004 10:54 AM
Send Mail error with Internet mail Douglazb Red Hat 6 11-10-2003 08:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration