Mailx , sendmail and mailhost


 
Thread Tools Search this Thread
Operating Systems Solaris Mailx , sendmail and mailhost
# 1  
Old 01-10-2016
Mailx , sendmail and mailhost

Hi all,

I am trying to grasp the concept between the 3 entity above.

I understand that mailx - MUA
I also understand that sendmail = MTA

1) If I have a centralized mail server (which might not be sendmail), can I just set mailhost in "/etc/hosts" to point to that mailserver and use mailx to send out the email ?

Does sendmail need to be involved in the process above ?

or

2) I need to have a sendmail running locally on the server, and have mailx send the mail to the sendmail, before sendmail send out to the "centralized mail server" ?
=================================

If mailx is using the local sendmail to send out mail, what should set at the "mailhost" parameter in /etc/hosts ?

if mailhost parameter meant for mailx or sendmail ? SmilieSmilie

=========================

It seems that mailx does not work, if i did not turn on my sendmail service, and mailx -v shows that it is connecting locally to 127.0.0.1.

However, whichever email address i send to , it seems that mailx is always sending to 127.0.0.1 even thought i have set "mailhost" in /etc/hosts to point to another server.

is mailhost here being referred to at all ? or sendmail will use it to relay the mail ?


Hope some gurus can shed some light on this.

Thanks!

Regards,
Noob

Last edited by javanoob; 01-10-2016 at 01:01 PM..
# 2  
Old 01-10-2016
Let's start from the beginning.
sendmail has to be running as (often) two daemons often started two ways (not always). The configuration files are:
Code:
/etc/mail/sendmail.cf	#Defines environment for sendmail
/etc/mail/submit.cf	#Defines environment for MSP (Mail submission program)

Code:
/usr/lib/sendmail -Ac -q15m
/usr/lib/sendmail -bd -q15m

sendmail is NOT normally used interactively from the command line, usually mailx is invoked to read to to submit mail. There are other interface programs like mailx. It is possible to use a local command-line process running sendmail to send and receive email. IMO it is hard to use. A lot of others agree - why mailx was written.

So the architecture is
1. a sendmail process to handle submitted emails
2. a sendmail process to deal with smtp - sending and receiving email locally and on the network.
3. mailx -and friends- for email users to read email and to send email. mailx is also often used in shell scripts to send email.

I honestly could not tell what you were asking, it seemed convoluted to me.
So, this is my attempt at an answer. The 2 sendmail process design is for Solaris 10 and newer -Solaris 9 is different just one process.

PS: do NOT directly edit one of the .cf files. A "feature" of sendmail is that it requires writing M4 preprocessor text which is then fed to M4 to generate the .cf file. There is a "makefile" for this process in the /etc/mail directory tree. Eric Allman wrote sendmail long ago - there are good books from O'Reilly on all of the complexities and nuances of sendmail - and there are many complexities.

Last edited by jim mcnamara; 01-10-2016 at 08:46 PM..
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 01-11-2016
1) it is Sun's tradition to ship a sendmail.cf with the relayhost set to mailhost.
Then you only need to define mailhost in the hosts file (or, even easier, in the naming service e.g. DNS).
1a) mailx, when delivering E-mail, spawns a sendmail that reads submit.cf.
The shipped submit.cf tells to deliver to port 25 on localhost.
2) there is also a sendmail daemon process that reads sendmail.cf and listens to port 25.
--
If you want mailx to deliver mail to mailhost without the sendmail daemon, you must define mailhost in submit.cf. Placing mailhost in the DS line should do it. (I would not go through the m4 hassle.)
This User Gave Thanks to MadeInGermany For This Post:
# 4  
Old 01-11-2016
Hi all,

Thanks for sharing the information above.

So can i said that , there are generally 3 processes involved

-mailx
-sendmail (for mailsubmission)
-sendmail (for mail relay)

Right ?

If i have set a mailhost in /etc/hosts on another server (e.g. ServerA) (-- p.s. i did not change anything in submit.cf)

is the path travel
a) mailx -> sendmail (mail submission) -> sendmail (local) --> mailhost (server A)?
or
b) mailx -> sendmail (mail submission) -> mailhost (server A)

Regards,
Noob
# 5  
Old 01-11-2016
Yes, right. (Well, a later sendmail daemon runs as two processes, one root and one non-root.)
Code:
a) mailx -> sendmail (mail submission) -> sendmail (local) -> mailhost (server A)
                  ^ default submit.cf                  ^ default sendmail.cf has mailhost

b) mailx -> sendmail (mail submission) -> mailhost (server A)
                  ^ mailhost in submit.cf

This User Gave Thanks to MadeInGermany For This Post:
# 6  
Old 01-11-2016
Quote:
Originally Posted by MadeInGermany
Yes, right. (Well, a later sendmail daemon runs as two processes, one root and one non-root.)
Code:
a) mailx -> sendmail (mail submission) -> sendmail (local) -> mailhost (server A)
                  ^ default submit.cf                  ^ default sendmail.cf has mailhost

b) mailx -> sendmail (mail submission) -> mailhost (server A)
                  ^ mailhost in submit.cf

Hi MadeInGermany,

Thanks for the reply.

In that case of b), do we still need to startup sendmail service on the local machine ?

Regards,
Noob
# 7  
Old 01-11-2016
b) No sendmail service/daemon needed.
This User Gave Thanks to MadeInGermany For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to sendmail using mailx in linux

how to sendmail to other computer in the same computer lab using mailx? (8 Replies)
Discussion started by: help me
8 Replies

2. UNIX for Advanced & Expert Users

mailx Vs sendmail to send internal emails to exchange

Hi Gurus, I have been searching for this around, but sendmail seems complicated and not sure if "mail" command would do, since all what I need to send internal emails from my solaris 10 box to our exchange server. Would the mailx or mail command do ? I tried the : # mailx -s test... (2 Replies)
Discussion started by: aladdin
2 Replies

3. Solaris

mailx/sendmail configuration/set up problem

Hello Good People of Linux World!!! Background: Recent Networking Graduate, thrown in line of fire. For the past couple of days I have been searching online for answers and haven't gotten anywhere regarding Mailx, Sendmail functionality on SunOS 5.9. My dilemma: Mailx / sendmail are... (28 Replies)
Discussion started by: kazmiM
28 Replies

4. Solaris

Configure mailx or sendmail

hi, I would like to configure mailx or sendmail to send out some mails to some users. I tried searching online for the configuration but it was kinda confusing. I thought that posting here might get someone to work with me step by step I tried sending out mail but i did not receive in my... (4 Replies)
Discussion started by: cghcgh
4 Replies

5. UNIX for Dummies Questions & Answers

Difference between mail,mailx,sendmail

Hello friends I need to know the difference between mail,mailx and sendmail commands. Thanks in advance (1 Reply)
Discussion started by: rocker
1 Replies

6. UNIX for Dummies Questions & Answers

Sendmail? Mailx? SMTP?

We require e-mails to come from one of our Solaris 10 boxes ASAP and have found that when using such things as Sendmail and Mailx all the mail goes to a Q that only fires every 15 minutes. We have tried everything we could think of to adjust this to force the Q to go every 1 minute but so far no... (3 Replies)
Discussion started by: LRoberts
3 Replies

7. UNIX for Dummies Questions & Answers

Remove certain headers using mailx or sendmail

Hello, So i want to send mails in any way from a solaris 5.8 system, perhaps using mailx or sendmail. My purpose is to stay clear of systems name in head data. So i want to strip at least the "Message-Id" and the "Recieved" headers of the mail. Yet this seems to be a bit of a problem. Now i... (2 Replies)
Discussion started by: congo
2 Replies

8. UNIX for Dummies Questions & Answers

get rid of certain tags with mailx or sendmail

Hello, So i want to get rid of "X-Authentication-Warning" when sending out mails with modified returnadress/senderadress ie. when executing "cat test.email | mailx -t -r me@www.tld" (in test.email theres given To, Subject and textmailcontent") - yet it says "UNIXUSER set sender to... (2 Replies)
Discussion started by: congo
2 Replies

9. UNIX for Dummies Questions & Answers

Postfix Problem under mailx/sendmail command

Update: Problem solved with this command: /opt/soc/bin/postfix-setup ================================ Hi, I am trying the following mailx command: sadm@edwardwi-z:/etc$ mailx ewijaya@gmail.com Subject: test foo . . EOT But it gives the following error ... (0 Replies)
Discussion started by: monkfan
0 Replies

10. UNIX for Dummies Questions & Answers

EXIT STATUS on mailx/sendmail

Hi there I am using mailx command to send mails. I want to send some important files to team members and wud like to know if the team member has recd my email or not. How can I achieve this ? Currently my piece of code is uuencode ${FILE_NAME} ${FILE_NAME} >> mail_msg.txt mailx -s"test... (5 Replies)
Discussion started by: Amruta Pitkar
5 Replies
Login or Register to Ask a Question