LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-28-2009, 03:57 PM   #1
wisperer
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Rep: Reputation: 0
Postfix SMTP relay via ISP problem


Hi,

For the last few weeks I've been building a network management system using Fedora 11, Nagios and Cacti. Everything is working fine apart from getting Nagios to send email notifications and I believe the problem is with the smtp relay config i've setup.

I started out trying to use sendmail. It worked with my ISP at home but when I moved to the production environment (using a different ISP) I wasn't able to get sendmail to send anything. After reading a few threads I thought i needed to use 'masquerading'. When I tried to set it up I managed to kill sendmail - wasn't even seeing anything in maillog. Tried reinstalling sendmail and sendmail-cf with no joy and didn't know what else to do to revert back to a 'vanilla' config (having not backed up the configs...)

So, I have moved over to postfix and at least getting maillog ok now. I can successfully send mail using telnet. I can get a message through when using the following line:

mailx -s test destaddress@domain.com -r sourceaddress@domain.com

but it sends an email with..

To:
sourceaddress@domain.com; -r@localhost.localdomain; destaddress@domain.com

From:
destaddress@domain.com

Is that the corrrect syntax? If so, why is the -r@ and sourceaddress included in the to field? And why is the From field the destaddress?

When I try to send with:

mailx -s test destaddress@domain.com

I get nothing through. I suspect my ISP is silently dropping it due to the source address being from localhost.locadomain or the like as maillog shows its accepted by the ISP's smtp server. Hence why I tried the -r option.

I'm really confused. Any pointers would be greatly appreciated! I've been battling with this for 4 days now and not sure what else to try. I'm still fairly new to linux and learning curve has been just about vertical so might need spoonfeeding a bit.

Thanks in advance.
 
Old 11-28-2009, 06:33 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by wisperer View Post
Hi,

For the last few weeks I've been building a network management system using Fedora 11, Nagios and Cacti. Everything is working fine apart from getting Nagios to send email notifications and I believe the problem is with the smtp relay config i've setup.

I started out trying to use sendmail. It worked with my ISP at home but when I moved to the production environment (using a different ISP) I wasn't able to get sendmail to send anything. After reading a few threads I thought i needed to use 'masquerading'. When I tried to set it up I managed to kill sendmail - wasn't even seeing anything in maillog. Tried reinstalling sendmail and sendmail-cf with no joy and didn't know what else to do to revert back to a 'vanilla' config (having not backed up the configs...)

So, I have moved over to postfix and at least getting maillog ok now. I can successfully send mail using telnet. I can get a message through when using the following line:

mailx -s test destaddress@domain.com -r sourceaddress@domain.com

but it sends an email with..

To:
sourceaddress@domain.com; -r@localhost.localdomain; destaddress@domain.com

From:
destaddress@domain.com

Is that the corrrect syntax? If so, why is the -r@ and sourceaddress included in the to field? And why is the From field the destaddress?

When I try to send with:

mailx -s test destaddress@domain.com

I get nothing through. I suspect my ISP is silently dropping it due to the source address being from localhost.locadomain or the like as maillog shows its accepted by the ISP's smtp server. Hence why I tried the -r option.

I'm really confused. Any pointers would be greatly appreciated! I've been battling with this for 4 days now and not sure what else to try. I'm still fairly new to linux and learning curve has been just about vertical so might need spoonfeeding a bit.

Thanks in advance.
Chances are you hit it right on the head, with your ISP dropping it silently. "localhost.localdomain" just screams "SPAMMER" in huge letters, so I'm not surprised it's getting dumped. Look into the masquerade feature, which will let you set your domain to be something 'real', or contact your ISP, and they may be able to offer solutions as well.
 
Old 11-28-2009, 06:47 PM   #3
dangermaus
LQ Newbie
 
Registered: Jun 2006
Posts: 6

Rep: Reputation: 0
I looked at he man page for mailx, and it looks like there is no command line argument for setting the reply address, looks like you use ~R (thats tilde and capital R) at the beginning of a line while composing the message. ie

mailx -s test recipient@domain.com <enter>
~R replyto@domain.com
your message here
.

but the message will still be sent using your.username@your.servers.domain.tld unless you have masquerading

Hope that helps.

P.S.

Acually it looks like you can modify the headers with -a so ..

mailx -a "Reply-To:me@here.org" -a "From:me@here.org" -s "This is the subject" you@there.com

found that little tidbit at http://www.solar1.net/smf/index.php/topic,43.0.html
 
Old 11-29-2009, 05:30 AM   #4
wisperer
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
thanks guys.

@TB0ne

Thanks - at least it sounds like i'm on the right track then. Will have another go at masquerading and if not will spk to the ISP.

@Dangermaus

Thanks for the suggestions. Tried both and with the ~R got an "Unknown tilde escape" and with the header rewriting got an "Reply-to:address@domain.com: No such file or directory"

Will keep pressing on!
 
Old 11-29-2009, 07:50 AM   #5
wisperer
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
have now solved it.. thanks for pointing me in the right direction!!!

All I had to do was change the 'myorigin' variable in main.cf to a valid domain. Mail came straight though with:

mailx -s "Subject" destemailaddress@adomain.com

And for anyone who reads this trying to get Nagios to use postfix..

Have now setup Nagios to use postfix successfully too - just had to change the 'mail' command to 'mailx' in /etc/nagios/objects/commands.cfg and then restart nagios:

validate the config…

nagios -v /etc/nagios/nagios.cfg

reload nagios

/etc/rc.d/init.d/nagios reload
 
  


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 as SMTP relay to exchange help GGlinux Linux - Server 6 07-29-2009 09:10 PM
Postfix SMTP 554 -- how do I relay mail? fultron Linux - Software 1 01-28-2009 04:01 PM
Postfix to relay through my ISPs SMTP with no tls problem icebrian Linux - Software 10 01-18-2007 06:45 PM
Postfix smtp relay issue aaf Linux - Software 3 11-22-2006 01:34 PM
sasl/postfix smtp relay problems 5teve-o Red Hat 0 04-02-2005 03:50 PM

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

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