LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-16-2013, 06:14 AM   #1
sunlinux
Member
 
Registered: Feb 2006
Distribution: RHCL 5
Posts: 239

Rep: Reputation: 30
avoid mail to localhost


I send mails using centos 6

mailx -r abc@abc.com -s "here is mail" aa@pmail.com -c tt@gmail.com

why does it send mail to localhost by default I want to avoid that.. pls suggest

on receiver end it shows mail sent to localhost.localdomain as well
 
Old 12-16-2013, 11:49 PM   #2
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,149

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
found this article on the link below, hope it helps you.

http://alexcline.net/2011/03/22/fix-...n-in-sendmail/

Quote:
I’m usually a postfix guy. That’s what I run on my servers and it’s the configuration I understand. So when someone asked me to take a look at an issue on a server running sendmail, I was a bit befuddled.
The problem was that any messages sent from the command line, were arriving with a from address of root@localhost.localdomain. This was a bit of a problem. To test and confirm I ran the following:
view sourceprint?
1
echo "Who will this message be addressed from? The world may never know." | mail -s "Testing sendmail" alex
And sure enough, I get an email address from root@localhost.localdomain. I end up Googling combinations of ‘root@localhost.localdomain’, ‘localhost.localdomain’ and ‘sendmail’. The options were pretty much useless. Too much noise about changing the sendmail configuration options.
In the end, I stumbled upon the real way to fix it….

Open /etc/hosts and change add the host’s name before the localhost.localdomain entry on the first line.

127.0.0.1 host.foobar.com host localhost.localdomain localhost

::1 localhost6.localdomain6 localhost6

Turns out, sendmail looks for the first hostname in the hosts file for the loopback address and uses that in the from field when a from address isn’t specified by the mail client.

Last edited by JJJCR; 12-16-2013 at 11:50 PM. Reason: edit
 
1 members found this post helpful.
  


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
How to make Sendmail forward all incoming mail to localhost port 26 (Domino mail) speedgelb Linux - Software 3 09-27-2013 10:18 AM
mail received at sendmail has relay=localhost [[UNIX: localhost]] check_rcpt fails chingupt Linux - Distributions 3 04-25-2013 05:36 PM
Mail from root@localhost.localdomain thru relay=localhost.localdomain[216.24.138.1] rshartog Linux - Server 2 02-02-2009 10:35 PM
How to avoid mail from at scheduled job? bomix Linux - Software 3 06-30-2005 06:22 PM
How to avoid the password when a mail sends out fidelis Linux - Security 1 09-13-2004 07:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:54 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