You are not logged in.

#1 2011-03-02 17:29:54

kilgour
Member
Registered: 2011-03-02
Posts: 1

ssmtp setup

Hi guys, I'm trying to set up ssmtp to send out emails from a server (monnmsp303) which needs to go to an internal Apache JAMES server (monappp086). I have set this up and it works as expected when sending as a root user. However, I am trying to get it to send out as the user nagios. When I receive an email sent from the nagios user, using the exact same command, has the From field is filled with the text "msp303", the subject is empty and the body of the text contains text with the To, From and Subject etc. Can anyone please explain where I am going wrong?

Here is my configuration:

[root@monnmsp303 ~]# less /usr/local/ssmtp/etc/ssmtp/ssmtp.conf

Debug=YES
#
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#

# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster

# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and your mailhub is so named.
mailhub=monappp086

# Example for SMTP port number 2525
# mailhub=mail.your.domain:2525
# Example for SMTP port number 25 (Standard/RFC)
# mailhub=mail.your.domain
# Example for SSL encrypted connection
# mailhub=mail.your.domain:465

# Where will the mail seem to come from?
rewriteDomain=nagios

# The full hostname
hostname=monnmsp303

# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
#FromLineOverride=YES

# Use SSL/TLS to send secure messages to server.
#UseTLS=YES

# Use SSL/TLS certificate to authenticate against smtp host.
#UseTLSCert=YES

# Use this RSA certificate.
#TLSCert=/etc/ssl/certs/ssmtp.pem

# Get enhanced (*really* enhanced) debugging information in the logs
# If you want to have debugging of the config file parsing, move this option
# to the top of the config file and uncomment
#Debug=YES


less /usr/local/ssmtp/etc/ssmtp/revaliases

# sSMTP aliases
#
# Format:       local_account:outgoing_address:mailhub
#
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.
root:nagios@monnmsp303


[nagios@monnmsp303 ~]# printf "%b" "To: PaulKilgour@socratesmail.mon.bbc.co.uk\nFrom: nagios@monnmsp303\nSubject:MySubject\n\nMY TEXT" | /usr/local/ssmtp/sbin/ssmtp PaulKilgour@socratesmail.mon.bbc.co.uk

[root@monnmsp303 ~]# less /var/log/maillog

Mar  2 17:03:44 monnmsp303 sSMTP[8957]: Set MailHub="monappp086"
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: Set RemotePort="25"
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: Set RewriteDomain="nagios"
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: Set HostName="monnmsp303"
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: 220 monappp086 SMTP Server (JAMES SMTP Server 2.3.2) ready Wed, 2 Mar 2011 17:03:50 +0000 (GMT)
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: HELO monnmsp303
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: 250 monappp086 Hello monnmsp303 (monnmsp303 [10.182.218.105])
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: MAIL FROM:<nagios@nagios>
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: 250 2.1.0 Sender <nagios@nagios> OK
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: RCPT TO:<PaulKilgour@socratesmail.mon.bbc.co.uk>
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: 250 2.1.5 Recipient <PaulKilgour@socratesmail.mon.bbc.co.uk> OK
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: DATA
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: 354 Ok Send data ending with <CRLF>.<CRLF>
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: Received: by monnmsp303 (sSMTP sendmail emulation); Wed, 02 Mar 2011 17:03:44 +0000
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: From: msp303
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: Date: Wed, 02 Mar 2011 17:03:44 +0000
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: To: PaulKilgour@socratesmail.mon.bbc.co.uk
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: Subject:MySubject
Mar  2 17:03:44 monnmsp303 sSMTP[8957]:
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: MY TEXT
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: .
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: 250 2.6.0 Message received
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: QUIT
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: 221 2.0.0 monappp086 Service closing transmission channel
Mar  2 17:03:44 monnmsp303 sSMTP[8957]: Sent mail for nagios@nagios (221 2.0.0 monappp086 Service closing transmission channel) uid=103 username=nagios outbytes=322


[root@monnmsp303 ~]# printf "%b" "To: PaulKilgour@socratesmail.mon.bbc.co.uk\nFrom: nagios@monnmsp303\nSubject:MySubject\n\nMY TEXT" | /usr/local/ssmtp/sbin/ssmtp PaulKilgour@socratesmail.mon.bbc.co.uk

[root@monnmsp303 ~]# less /var/log/maillog

Mar  2 17:05:06 monnmsp303 sSMTP[19061]: Set MailHub="monappp086"
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: Set RemotePort="25"
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: Set RewriteDomain="nagios"
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: Set HostName="monnmsp303"
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: 220 monappp086 SMTP Server (JAMES SMTP Server 2.3.2) ready Wed, 2 Mar 2011 17:05:12 +0000 (GMT)
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: HELO monnmsp303
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: 250 monappp086 Hello monnmsp303 (monnmsp303 [10.182.218.105])
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: MAIL FROM:<nagios@monnmsp303>
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: 250 2.1.0 Sender <nagios@monnmsp303> OK
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: RCPT TO:<PaulKilgour@socratesmail.mon.bbc.co.uk>
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: 250 2.1.5 Recipient <PaulKilgour@socratesmail.mon.bbc.co.uk> OK
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: DATA
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: 354 Ok Send data ending with <CRLF>.<CRLF>
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: Received: by monnmsp303 (sSMTP sendmail emulation); Wed, 02 Mar 2011 17:05:06 +0000
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: From: "root" <nagios@monnmsp303>
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: Date: Wed, 02 Mar 2011 17:05:06 +0000
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: To: PaulKilgour@socratesmail.mon.bbc.co.uk
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: Subject:MySubject
Mar  2 17:05:06 monnmsp303 sSMTP[19061]:
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: MY TEXT
Mar  2 17:05:06 monnmsp303 sSMTP[19061]: .
Mar  2 17:05:07 monnmsp303 sSMTP[19061]: 250 2.6.0 Message received
Mar  2 17:05:07 monnmsp303 sSMTP[19061]: QUIT
Mar  2 17:05:07 monnmsp303 sSMTP[19061]: 221 2.0.0 monappp086 Service closing transmission channel
Mar  2 17:05:07 monnmsp303 sSMTP[19061]: Sent mail for nagios@monnmsp303 (221 2.0.0 monappp086 Service closing transmission channel) uid=0 username=root outbytes=345

Any help would be greatly appreciated.

Many thanks,

Paul

Offline

Board footer

Powered by FluxBB