0

I am sending an email with content, subject and attachment on a Solaris system. Some users are receiving the mail ok with CSV file and everything, and some users are receiving a content in base64 style like hieroglyphs. The problem is, that when I send email to some domain is working and to some not.

echo ${BODY}; uuencode /data/${FILE} ${FILE}) | mailx -r "[email protected]" -s "Export csv file" "[email protected]"

So my question is how to implement in a different way this part of code. It is a bash script and everything works fine (so I don't want to change all of it) but probably I have to change uuencode part. I can not use mutt or mail.

I think Content Type “application/vnd.ms-excel” should be used in my case, but do not know how to implement all this.

3
  • 1
    This is the second or third time you've asked the same question. Deleting and asking again isn't going to get you different answers. The answers are pretty much always going to be: 1. don't use uuencode, send a message with proper mime attachments. 2. use a version of mail or mailx that supports mime attachments. 3. if you don't have a version of mail/mailx that can do that, try something like the mime-construct perl script. 4. don't use uuencode, in case you forgot #1.
    – cas
    May 13, 2021 at 16:07
  • 1
    the reason why some of your users are seeing "base64 style like hieroglyphs" is that uuencode is obsolete and has been for many years. Very few (as in almost none) mail clients recognise or know what to do with uuencoded data in the body of a message, they'll just display it as text. Use MIME.
    – cas
    May 13, 2021 at 16:10
  • To add to @cas: #5: Do not use uuencode! (Has the point been made clear yet?) uuencode is old, outdated, and many modern mail programs (and servers) do not know how to handle embedded uuendode--it is just raw data to them. IF, for some reason, you need to use uuencode, then your receivers will need to know to uudecode it on their own.
    – C. M.
    May 14, 2021 at 1:47

1 Answer 1

2

You could let mailx handle everthing:

echo ${BODY} | mailx -r "[email protected]" -s "Export csv file" -A /data/${FILE} "[email protected]"

If needed, you can use --encoding to set the encoding and the following flags to define the attached file (set them before -A).

--content-filename=NAME
      set the Content-Disposition filename parameter for the next --attach option

--content-name=NAME
      set the Content-Type name parameter for the next --attach option

--content-type=TYPE
      set content type for subsequent --attach options

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .