[CentOS] Conversion from Centos 5 to Centos 7 & mailx changes

Fri Sep 4 20:32:16 UTC 2020
Stephen John Smoogen <smooge at gmail.com>

On Fri, 4 Sep 2020 at 16:00, Gregory P. Ennis <PoMec at pomec.net> wrote:

> Everyone,
>
> I have just upgraded a Centos 5 server to a Centos 7 server and am
> having difficulty with a change of behavior of mailx with the use of a
> command line of :
>
> mail -s 'This is the subject' user at domain.com < text_file.txt
>
> On Centos 5 when mailx was used by a program started by a cron job we
> were able to send a text file as an email message and the headers did
> not contain 'Content-Transfer-Encoding: base64'
>
>
The version of mailx in Red Hat Enterprise Linux 5 is based off the old BSD
mailx program (in Debian it looks like it is still available as bsd-mailx).
That version was 'bit' rotting and having problems with newer mail
servers.  For an afternoon read
http://heirloom.sourceforge.net/mailx_history.html and
https://www.redhat.com/archives/rhl-devel-list/2008-June/msg00628.html [It
looks like this was further forked into s-nail which Debian, Ubuntu, Arch,
etc seem to ship as the default for mailx now.]

Looking for why this change was done I found these:

https://www.redhat.com/archives/rhl-devel-list/2008-June/msg00632.html
https://www.redhat.com/archives/rhl-devel-list/2008-June/msg00641.html

which says one of two ways to hack around this problem:
1. Put in /etc/mail.rc the items needed
2. Try the MAILRC=/dev/null hack

and finally a google "heirloom mailx Content-Transfer-Encoding base64" got
me to

https://stackoverflow.com/questions/10343106/linux-mail-file-log-has-content-type-application-octet-stream-a-noname-attac


which seems to offer changing it to

cat -v {{file}} | mail -s "your subject" "your at recipient.internet"




> On Centos 7 the headers contain 'Content-Transfer-Encoding: base64' and
> when the client gets the e-mail they are unable to open it up.
>
> The interesting thing is that on Centos 7 when the command line is used
> by typing the above command 'Content-Transfer-Encoding: 7bit' is placed
> in the header and the client can see the e-mail without a problem.
>
> I have looked for a way to control the 'Content-Transfer-Encoding:'
> header to '7bit' when we use a cron job, but I have not been able to
> figure out how.
>
> Your suggestions would be appreciated.
>
> Thank you,
> --
> Greg Ennis
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>


-- 
Stephen J Smoogen.