Computing.Net > Forums > Unix > Unix Email

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Unix Email

Reply to Message Icon

Original Message
Name: Leigh
Date: November 21, 2002 at 20:29:49 Pacific
Subject: Unix Email
OS: SCO OpenServer 5.1
CPU/Ram: ??
Comment:

Does anyone know how I can use the contents of a file as the text of an email then attach that same file to the email.

I realise this seems like a strange scenario but I need the recipient to be able to read the message then be able to save the attachment so it can be imported into a desktop application.

Thankx

Leigh


Report Offensive Message For Removal


Response Number 1
Name: David Perry
Date: November 22, 2002 at 04:43:08 Pacific
Reply: (edit)

(uuencode filetobeattached attachmentname.extension; uuencode filetobeattached attachmentname.extension; echo "text") | mail -s "Subject" EmailAddress

The above command will send 2 attachments (you could have as many as you want by stringing more uuencode commands together between the parentheses) and puts some text in the body by using echo (you could cat the contents of a file also for the body). Of course you can put the echo/print/cat command at the beginning of the commands that are strung together so that the body text comes first and then the attachments.


Report Offensive Follow Up For Removal

Response Number 2
Name: Leigh
Date: November 24, 2002 at 16:18:18 Pacific
Reply: (edit)

David,
Thanks for the info, but unfortunatley it's not working as I would like. The file that should be attached is appearing as garbage at the top of the email. The text I want as the body is fine, but the other is rubbish.

( uuencode 2790.pit pit.txt ; cat 2790.pit ) | mail -s "Test" EMAILADDRESS

Anyone have any thoughts?

Thankx


Report Offensive Follow Up For Removal

Response Number 3
Name: David Perry
Date: November 25, 2002 at 05:59:50 Pacific
Reply: (edit)

Is 2790.pit a text file? Is cat 2790.pit meaningful ?
Try reversing the order

( cat 2790.pit ; uuencode 2790.pit pit.txt ) | mail -s "Test" EMAILADDRESS

You might also need to include a pipe through unix2dos to fix any line ending problems.

( cat 2790.pit ; cat 2790.pit | unix2dos | uuencode pit.txt ) | mail -s "Test" EMAILADDRESS


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software