Solved

Unix mailx attachment syntex

Posted on 2000-03-13
12
75,869 Views
Last Modified: 2011-08-18
Looking for syntex for mailx command to have file go as an attachment.
When sending file as text I type
mailx -s "My Email Topic" johndoe@somesite.com < mytext.txt
and the text appears as the body of the email.
What would be the syntex to have mytext.txt be an attached file?
0
Comment
Question by:widrzk
  • 4
  • 2
  • 2
  • +3
12 Comments
 

Author Comment

by:widrzk
Comment Utility
Adjusted points to 150
0
 
LVL 40

Expert Comment

by:jlevie
Comment Utility
mailx can't do attachments. For that you'd need a client program that understands how to create MIME messages. Pine (http://www.washington.edu/pine) can be used on most any Unix and it knows how to do attachements.
0
 
LVL 14

Accepted Solution

by:
mcrider earned 150 total points
Comment Utility
Actually, mailx CAN do attachments... Just UUECODE the file you are going to attach and then append the uuencoded file at the end of the body of the message.  Make sure you put a blank line between the last message line and the start of the uuencoded file...



Cheers!®©
0
 
LVL 40

Expert Comment

by:jlevie
Comment Utility
Well, that's sort of true and it depends on what the addressee's mail client can do and/or how much work the addressee has to go through to get to the uuencoded data. I suspect that what the questioner wants is to have true multi-part messages.
0
 
LVL 14

Expert Comment

by:mcrider
Comment Utility
jlevie,

Not sort of true... IS true.  widrzk never asked anything about multi-part messages, just wanted to attach a file.

Almost every mail client built is able to handle uuencoded attachments.  In fact, alot of them DONT handle MIME.


Cheers!®©
0
 

Author Comment

by:widrzk
Comment Utility
Referenced uuencode man page on unix.  The path comment was a little vague.  Basically I used as:
uuencode testfile.txt testfile.dat > testfile.dat
where testfile.txt is the file to be encoded,
testfile.dat - becomes the name of the attachment
and > testfile.dat - the piped encoded file.

Used emailbody.txt as the body of the message,
blanklines.txt to separate.  Appended all by:

cat emailbody.txt blanklines.txt testfile.dat > email.msg

Then send syntex:
mailx -s "Test Email UUENCODE Attachment" somebloke@somewhere.com < email.msg

Came out fine.  Thanks
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 14

Expert Comment

by:mcrider
Comment Utility
Thanks for the points... Glad I could help!


Cheers!®©
0
 

Expert Comment

by:charliesweet
Comment Utility
Hi,

Attachments can be sent via mailx and all kinds of attachments can be sent.

Syntax:

(uuencode AAA AAA )| mailx -s "subject" a@b.com

here AAA is the file you want to send as attachment. I would like you to write this with the extension also. it mite get junked otherwise.

Hope this helps.

- charlie -
0
 

Expert Comment

by:shiva_kalidindi
Comment Utility

Hi,

I would like to send two files as seperate attachments in a mail. how can i do this using mailx in AIX 5.0?

thanks,
Shiva
0
 
LVL 1

Expert Comment

by:kampol_t
Comment Utility
Hi charliesweet,

I tried your syntex

(uuencode AAA AAA )| mailx -s "subject" a@b.com

on SCO Openserver 6. It does not work. What os r u using?

Thanks.
0
 
LVL 1

Expert Comment

by:kampol_t
Comment Utility
Hi,

I followed 'mcrider' comments, it works!

Thanks.
0
 
LVL 14

Expert Comment

by:mcrider
Comment Utility
kampol_t .... Thanks! Glad I could help.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now