?
Solved

Unix mailx attachment syntex

Posted on 2000-03-13
12
Medium Priority
?
75,898 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
ID: 2613052
Adjusted points to 150
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2613240
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 600 total points
ID: 2613405
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 40

Expert Comment

by:jlevie
ID: 2613460
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
ID: 2613564
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
ID: 2613615
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
 
LVL 14

Expert Comment

by:mcrider
ID: 2613660
Thanks for the points... Glad I could help!


Cheers!®©
0
 

Expert Comment

by:charliesweet
ID: 7381811
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
ID: 12604551

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
ID: 24485177
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
ID: 24485253
Hi,

I followed 'mcrider' comments, it works!

Thanks.
0
 
LVL 14

Expert Comment

by:mcrider
ID: 24498908
kampol_t .... Thanks! Glad I could help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

840 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