specify SMTP relay server in mutt

Harris, Don don.harris at unf.edu
Wed Jul 16 03:12:12 UTC 2014


On 7/15/14 10:47 PM, "Sunhux G" <sunhux at gmail.com> wrote:

>mutt & mailx are MUA (Message User Agent) while
>postfix (& I think sendmail) have both MTA and MUA
>functions (ie they can act as SMTP servers besides
>as MUA).

That's mostly correct, but mailx can do what you need in this case,
without a local MTA. Here's a modified version of your original mutt
example but using mailx with an option to specify an external MTA.

$ mailx -s "Test mail" -a /tmp/file.tar.gz -S "smtp=your.relayhost.here"
abcde at nixcraft.co.in < /tmp/mailmessage.txt

>
>I guess mailx will require sendmail.cf to be edited as
>well: if only we have sort of script that does something
>like the telnet & the series of HELO...DATA commands,
>that will be wonderful (as I think it doesn't require an
>MTA (eg: sendmail & postfix) to be running.

Sendmail was the default MTA in RHEL5, Postfix in RHEL 6. Both are
reasonably locked down to accept mail only on the loopback as I recall, so
not much of a risk, at least from the network, IMO. There are benefits to
running a local MTA vs the mailx example as well, namely a MTA will queue
and retry if the remote relay is unavailable for some reason. That being
said, if you can't or don't want to use a local MTA, the mailx example
should work.

>
>Correct me if my understanding is incorrect.
>
>
>SH
>
>
>On Wed, Jul 16, 2014 at 10:26 AM, Fred Smith
><fredex at fcshome.stoneham.ma.us>
>wrote:
>
>> On Wed, Jul 16, 2014 at 10:00:37AM +0800, Sunhux G wrote:
>> > Thanks Fred.
>> >
>> > Sendmail was listed by our audit as a non-secure
>> > service.  Must sendmail be started or is there any
>> > other alternative to send email?
>>
>> there are other tools to do a similar job, but the only one
>> I've used, personally, is sendmail. I think Postfix is another
>> one that may be in  Centos, though I have no experience with it.
>>
>> >
>> > Think in Windows environment, blat & sendemail
>> > doesn't require an equivalent service to work so
>> > if there is some other ways of sending email, will
>> > be great, say using telnet:
>> >
>> > (does anyone has a script that could read in the
>> >  content of a text file, ie line 1-3 below & then
>> >  perform the steps below) :
>> >
>> > # telnet SMTP_Relay_IP 25
>> > HELO
>> > 501 Syntax: HELO hostname
>> > HELO smtp.mypostfixdomain.com
>> > 250 hostname.mypostfixdomain.com
>> > MAIL FROM:<sender_id at external_domain.com.sg>
>> > 250 2.1.0 Ok
>> > HELO smtp.mypostfixdomain.com
>> > 250 hostname.mypostfixdomain.com
>> > MAIL FROM:<sender_id at external_domain.com.sg>
>> > 250 2.1.0 Ok
>> > RCPT TO:<recipient_id at mypostfixdomain.com>
>> > 250 2.1.5 Ok
>> >
>> > RCPT TO:<root at mypostfixdomain.com>
>> > 250 2.1.5 Ok
>> > DATA
>> > 354 End data with <CR><LF>.<CR><LF>
>> > line 1
>> > line 2
>> > line 3
>> > *.*
>> > 250 2.0.0 Ok: queued as BAF8A200034
>> >
>> >
>> > On Wed, Jul 16, 2014 at 12:58 AM, Fred Smith <
>> fredex at fcshome.stoneham.ma.us>
>> > wrote:
>> >
>> > > On Wed, Jul 16, 2014 at 12:35:19AM +0800, Sunhux G wrote:
>> > > > I have got the firewall rule permitted from our RHEL 5.x &
>> > > > RHEL 6.x servers to our SMTP relay server (it's running
>> > > > RHEL 5.8).
>> > > >
>> > > > In the past, I recall I have a server that I could just issue
>> > > > mutt command below & it will send email out via that
>> > > > relay server :
>> > > > mutt -s "Test mail" -a /tmp/file.tar.gz abcde at nixcraft.co.in <
>> > > > /tmp/mailmessage.txt
>> > > >
>> > > >
>> > > > Now all my servers (at another site) can't send email out.
>> > > > Did I need to set something at this site's server or is
>> > > > there any way that I could specify the SMTP relay server
>> > > > in the mutt command?  In Windows, blat & sendemail
>> > > > allows me to specify the SMTP relay server.
>> > >
>> > > Assuming you've got sendmail installed, and are using the default
>> > > sendmail.cf,
>> > > become root, then:
>> > >
>> > > cd /etc/mail
>> > > vi sendmail.cf
>> > >
>> > > search for a line beginning with "DS", with a comment above it
>>reading:
>> > >         "Smart" relay host (may be null)
>> > > and change the line that reads just "DS" to read
>>"DSyoursmarthost.foo"
>> > > or whatever the FQDN is of your smart relay host. there is NOT a
>>space
>> > > between the "DS" and the FQDN.
>> > >
>> > > you'll probably need to restart the sendmail service afterward.
>> > >
>> > > --
>> > > ---- Fred Smith -- fredex at fcshome.stoneham.ma.us
>> > > -----------------------------
>> > >                Show me your ways, O LORD, teach me your paths;
>> > >                      Guide me in your truth and teach me,
>> > >                          for you are God my Savior,
>> > >                     And my hope is in you all day long.
>> > > -------------------------- Psalm 25:4-5 (NIV)
>> > > --------------------------------
>> > >
>> > > --
>> > > redhat-list mailing list
>> > > unsubscribe 
>>mailto:redhat-list-request at redhat.com?subject=unsubscribe
>> > > https://www.redhat.com/mailman/listinfo/redhat-list
>> > >
>> > --
>> > redhat-list mailing list
>> > unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
>> > https://www.redhat.com/mailman/listinfo/redhat-list
>>
>> --
>> ---- Fred Smith -- fredex at fcshome.stoneham.ma.us
>> -----------------------------
>>    "For the word of God is living and active. Sharper than any
>>double-edged
>>    sword, it penetrates even to dividing soul and spirit, joints and
>> marrow;
>>               it judges the thoughts and attitudes of the heart."
>> ---------------------------- Hebrews 4:12 (niv)
>> ------------------------------
>>
>> --
>> redhat-list mailing list
>> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
>> https://www.redhat.com/mailman/listinfo/redhat-list
>>
>-- 
>redhat-list mailing list
>unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
>https://www.redhat.com/mailman/listinfo/redhat-list





More information about the redhat-list mailing list