Re: specify SMTP relay server in mutt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



http://superuser.com/questions/137461/does-mailx-send-mail-using-an-smtp-relay-or-does-it-directly-connect-to-the-targ

Is the above mailx example for RHEL 6.x's mailx?


Found a script below but not sure if it's Shell or how it should
be executed:

 {
    echo 'helo me'
    echo 'MAIL FROM:<you@xxxxxxxxxxxxxx>'
    echo 'RCPT TO: <someone@xxxxxxxxxxxxxxx>'
    echo 'DATA'
    echo -e 'To:someone@xxxxxxxxxxxxxxx\nMIME-Version: 1.0
 (mime-construct 1.9)\nContent-Type:
 application/octet-stream\nContent-Transfer-Encoding: base64\n\n'
    cat myattachment.bin | openssl base64
    echo '.'
 } | nc smtp.mydomain.org 25


SH


On Thu, Jul 17, 2014 at 11:53 PM, Sunhux G <sunhux@xxxxxxxxx> wrote:

>
> To be sure I get this right, the bundled mailx in RHEL6.x support the
> option
>      -S "smtp=172.20.1.92"  ?  <== did I get this syntax right?
>
> Do you have mailx from EPEL installed in your RHEL & does it run any
> vulnerable services?  We have regular VA scans so this might be one
> consideration when I raise Change Requests to install it.
>
> Heard of 'Expect' & TCL scripts but I'm quite handicapped with them.
> A few  years ago, I saw in one RHEL 4.x a Perl script that send
> email (without using any tools like mutt/mailx) so if anyone happen
>  to have a copy to share, will save me the hassle of raising Change
> Requests as Perl interpreter is present by default in RHEL 5.x and
> putting in a Perl script doesn't need Change Requests.
>
> We have mostly RHEL 5.x & only 20 odd RHEL 6.x.
>
> My purpose was to email out outputs of 'last', 'lastlog' & 'getent'
> on fortnight basis as part of user accounts re-certification audit.
>
>
> Thanks
> SH
>
>
> On Thu, Jul 17, 2014 at 9:16 PM, Harris, Don <don.harris@xxxxxxx> wrote:
>
>> Oops, I see now that the mailx on RHEL5 and RHEL6 and very different
>> beasts.
>>
>> RHEL5: mailx-8.1.1-44.2.2
>> RHEL6: mailx-12.4-7.el6.x86_64 http://heirloom.sourceforge.net/mailx.html
>>
>> The legacy mailx on RHEL5 doesn't support all those options. If it's
>> acceptable in your environment, you can get the newer "Heirloom" mailx
>> from the EPEL repository. Note that it's the "nail" package on EPEL. See
>> https://fedoraproject.org/wiki/EPEL
>>
>> HTH,
>> Don
>>
>> On 7/17/14 7:52 AM, "Sunhux G" <sunhux@xxxxxxxxx> wrote:
>>
>> >Have to remove both -a & -S in order not to get the syntax
>> >error but the emails never arrive:
>> >(I'm able to 'telnet 172.20.1.92 25' from the server that mailx is issued
>> >from)
>> >
>> ># mailx -s "test5" -u root  "smtp=172.20.1.92" recipient@xxxxxxx <
>> >/tmp/cis/group.tmp
>> >    Or
>> ># mailx -s "test5" -u root "smtp=172.20.1.92:25" recipient@xxxxxxx <
>> >/tmp/cis/group.tmp
>> >
>> >
>> >If I issue just the command below from the sendmail relay
>> >server itself (without the -S & without "smtp=IP_of_SMTP"),
>> >the emails arrive:
>> >
>> > mailx -s "from SMTP2 server" external_recipient@xxxxxxx < /tmp/tst.dat
>> >
>> >I browsed thru the man pages for mailx : can't
>> >locate a -S or "smtp=a.b.c.d" option.  Did I miss
>> >something?
>> >
>> >
>> >
>> >On Thu, Jul 17, 2014 at 7:37 PM, Sunhux G <sunhux@xxxxxxxxx> wrote:
>> >
>> >>
>> >> What Harris gave with mailx is probably what I'm looking for,
>> >> just that I can't get the syntax right with -a (or even if I leave
>> >> out the -a option) :
>> >>
>> >> # mailx -s "test" -a /tmp/tst.tar.gz -S "smtp=172.20.1.92"
>> >> recipient@xxxxxxx < /tmp/cis/group.tmp
>> >>     Or (without the -u )
>> >> # mailx -s "test" -a /tmp/tst.tar.gz -u whitelistid@xxxxxxx -S
>> >> "smtp=172.20.1.92" recipient@xxxxxxx < /tmp/cis/group.tmp
>> >> mailx: invalid option -- a
>> >> Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...
>> >>             [-- sendmail-options ...]
>> >>        mail [-iInNv] -f [name]
>> >>        mail [-iInNv] [-u user]
>> >> What did I miss?  I've tried with uuencode (referring to some
>> >> examples on the Net) too but no joy
>> >>
>> >>
>> >> SH
>> >>
>> >--
>> >redhat-list mailing list
>> >unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
>> >https://www.redhat.com/mailman/listinfo/redhat-list
>>
>>
>> --
>> redhat-list mailing list
>> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
>> https://www.redhat.com/mailman/listinfo/redhat-list
>>
>
>
-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list




[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux