.Dat Attachment Instead of Text Using Mailx in Redhat Linux

Sending simple message body + file attachment using Linux Mailx

The usual way is to use uuencode for the attachments and echo for the body:

(uuencode output.txt output.txt; echo "Body of text") | mailx -s 'Subject' user@domain.com

For Solaris and AIX, you may need to put the echo statement first:

(echo "Body of text"; uuencode output.txt output.txt) | mailx -s 'Subject' user@domain.com

Use Japanese characters in subject and attach file with mailx in RedHat Linux

There's a list of things you need help with here, more than I want to to handle exhaustively on a sunny Saturday afternoon. But some hints.

Quote your variables.

"$SUBJECT_1" is a single string, whereas $SUBJECT_1 is a list of space-separated words. The second word is your email recipient, and subsequent options are also recipients.

Subject.

The basic idea is that you need to include encoding data in the subject, because email headers are only supposed to include 7-bit ASCII.

Here is a hint at how you put special characters in your Subject line.

Here is another hint.

Here is the RFC that describes in lurid detail what you need to do. Asking your favourite search engine for information about "utf8 email subject" and "rfc1522" is probably a good idea.

Email client.

Finally, rather than learning how to use MIME, consider using mutt instead of mailx to send your mail. Mutt has a -a option to add attachments, making it WAY easier than constructing your own headers and body, which I'm not even sure you'd be able to do with mailx in the first place.

How do you pull text out of a file and Email it as the body in Redhat?

We ended up using the mail command instead.

$ mail –s “Subject of email” email@example.com < /text.rtf

some documentation can be found at https://www.binarytides.com/linux-mail-command-examples/ or using the "man mail" command.

How do I send stdout as an attachment via mailx?

Fixed:

( echo "Subject: ls"; ls -l ~ | uuencode att0.txt; ls -l /tmp | uuencode att1.txt) | sendmail someone@somewhere.org

Ugly, but working. What you can do.



Related Topics



Leave a reply



Submit