LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 01-24-2016, 01:03 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,612

Rep: Reputation: 180Reputation: 180
Can I send email without MTA?


I have a Linux (Ubuntu) desktop workstation. I would like to be able to send messages to the DC server (which is also the mail server) from a shell script to e.g. notify of a backup completed or such-like, but I really don't want to configure a sendmail server or any other MTA on this workstation. It there a way to send an email without an MTA? I know I could pipe a message into `telnet host 25`, but that seems a bit crude.
 
Old 01-24-2016, 01:26 PM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,665

Rep: Reputation: Disabled
http://linux.die.net/man/1/mailx
 
Old 01-24-2016, 01:50 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Quote:
Originally Posted by mfoley View Post
I have a Linux (Ubuntu) desktop workstation. I would like to be able to send messages to the DC server (which is also the mail server) from a shell script to e.g. notify of a backup completed or such-like, but I really don't want to configure a sendmail server or any other MTA on this workstation. It there a way to send an email without an MTA? I know I could pipe a message into `telnet host 25`, but that seems a bit crude.
Mailx is one solution, but honestly if you've already got a mail server, you don't have to configure really ANYTHING on postfix or sendmail. Just a single line, defining the smart/relay host, and start the service. Any mail will be relayed to the smart host to deal with.
For sendmail, modify the line in sendmail.cf, look for the line that starts with a capital DS, typically blank on new installations:
Code:
DSsome.hostname.com  (or use IP address)
Postfix, in main.cf
Code:
relayhost = some.hostname.com
Start either service, and you're done.
 
Old 01-25-2016, 06:55 PM   #4
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,612

Original Poster
Rep: Reputation: 180Reputation: 180
Quote:
Originally Posted by TB0ne View Post
Mailx is one solution, but honestly if you've already got a mail server, you don't have to configure really ANYTHING on postfix or sendmail. Just a single line, defining the smart/relay host, and start the service. Any mail will be relayed to the smart host to deal with.
For sendmail, modify the line in sendmail.cf, look for the line that starts with a capital DS, typically blank on new installations:
Code:
DSsome.hostname.com  (or use IP address)
Postfix, in main.cf
Code:
relayhost = some.hostname.com
Start either service, and you're done.
So, I guess the answer is "no, you need an MTA". Yes, setting up sendmail is pretty easy, I've done it a-plenty on many systems. I was just hoping to avoid starting another service on this workstation -- and a rarely used one at that.

And, it's not quite true that I "don't have to configure really ANYTHING." I had to get the packages:

apt-get install sendmail heirloom-mailx

and add the following lines to as-shipped /etc/sendmail.mc to make it do what I want:

define(`confDOUBLE_BOUNCE_ADDRESS',`nobody')dnl
define(`SMART_HOST',`my.smart.host')dnl
FEATURE(`always_add_domain')dnl
MASQUERADE_AS(`mydom.org')
FEATURE(`masquerade_envelope')
FEATURE(`masquerade_entire_domain')
EXPOSED_USER(`root')dnl
LOCAL_DOMAIN(`localhost.localdomain')dnl

Then create a new sendmail.cf

service sendmail stop
m4 sendmail.mc >senmail.cf
service sendmail start

Not A LOT of work; so I went ahead and configured sendmail and it works just fine.

THX
 
Old 01-26-2016, 07:33 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Quote:
Originally Posted by mfoley View Post
So, I guess the answer is "no, you need an MTA". Yes, setting up sendmail is pretty easy, I've done it a-plenty on many systems. I was just hoping to avoid starting another service on this workstation -- and a rarely used one at that.
Well, mailx will work in this scenario...I only mentioned postfix/sendmail, because (given your environment), you'd only have to set the one line, and it would be lightweight, given it's only sending the occasional email out.
Quote:
And, it's not quite true that I "don't have to configure really ANYTHING." I had to get the packages:

apt-get install sendmail heirloom-mailx

and add the following lines to as-shipped /etc/sendmail.mc to make it do what I want:

define(`confDOUBLE_BOUNCE_ADDRESS',`nobody')dnl
define(`SMART_HOST',`my.smart.host')dnl
FEATURE(`always_add_domain')dnl
MASQUERADE_AS(`mydom.org')
FEATURE(`masquerade_envelope')
FEATURE(`masquerade_entire_domain')
EXPOSED_USER(`root')dnl
LOCAL_DOMAIN(`localhost.localdomain')dnl

Then create a new sendmail.cf

service sendmail stop
m4 sendmail.mc >senmail.cf
service sendmail start

Not A LOT of work; so I went ahead and configured sendmail and it works just fine.
THX
Glad it's working for you.
 
Old 01-27-2016, 01:53 AM   #6
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,612

Original Poster
Rep: Reputation: 180Reputation: 180
Oh wait! I get it! I could just use mailx and have e.g.

set smtp=my.smart.host

in my $HOME/.mailrc file, and not have sendmail running at all, right? I never tried that before, but I did just now and it seemed to work.

Or I suppose I could use `mailx -S smtp=my.smart.host` - that also works. I didn't realize that's what you guys were driving at.

These ideas are actually better because I don't expect message to be received at this workstation.

Last edited by mfoley; 01-27-2016 at 01:54 AM.
 
Old 01-27-2016, 09:37 AM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Quote:
Originally Posted by mfoley View Post
Oh wait! I get it! I could just use mailx and have e.g.

set smtp=my.smart.host

in my $HOME/.mailrc file, and not have sendmail running at all, right? I never tried that before, but I did just now and it seemed to work.

Or I suppose I could use `mailx -S smtp=my.smart.host` - that also works. I didn't realize that's what you guys were driving at. These ideas are actually better because I don't expect message to be received at this workstation.
Yeah, either will work fine. Mailx has a 'built-in' MTA, to let it talk directly to a smart host for relaying. Personally, just configuring the smart host in sendmail/postfix is my preferred solution, but that's just preference.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix MTA can't send mail outside sibsankaradak Linux - Server 2 11-26-2014 03:23 AM
email without local mta daemon running jag7720 Linux - Server 4 07-18-2012 06:38 PM
[SOLVED] What is the default email (MTA) for RHEL6 vwtech Linux - Software 3 01-17-2011 01:26 PM
How do I send emails by PHP on FC3 (and configure the MTA)? murr4y Linux - Newbie 3 09-01-2005 04:20 PM
recommended email (mta) for stable? Tisch Debian 5 01-12-2004 03:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 02:00 PM.

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