Computing.Net > Forums > Unix > How to attach a file in a mail (UNIX script)

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to attach a file in a mail (UNIX script)

Reply to Message Icon

Name: nauj
Date: October 20, 2009 at 09:17:37 Pacific
OS: AIX 5.1
CPU/Ram: IBM
Product: Ibm / Ibm
Subcategory: Software Problems
Comment:


I want to send an attachment in a mail, in a unix script

mail -s "subject" user@outlook

How can i attach a file in the e-mail.

Any advice will be greatly apreciatted.



Sponsored Link
Ads by Google

Response Number 1
Name: wollie
Date: October 22, 2009 at 06:40:28 Pacific
Reply:

mail -s "subject" user@outlook < attachment-full-qualified-filename


0

Response Number 2
Name: nauj
Date: October 23, 2009 at 00:16:53 Pacific
Reply:

Thanks for the reply

It's not exatcty what I need, I don't want the file in the text of the e-mail (in the body), I want the file as a attached file in the e-mail. It's posible that I will need to atachh more tha one file.

Thanks


0

Response Number 3
Name: Fist (by fmwap)
Date: October 23, 2009 at 00:48:19 Pacific
Reply:

Set your content type to multipart/mixed

Define the boundary

Encode the files

Start the next boundary, define content-type, charset & encoding

Attach encoded file

Wash, rinse, repeat.


E-mails are always plaintext - it's a pain but you can do the above, here's an example in php:
http://www.webcheatsheet.com/php/se...

Although you'll need a little more than that if you're transfering binaries.


0

Response Number 4
Name: wollie
Date: October 23, 2009 at 05:30:33 Pacific
Reply:

uuencode attachment-file encoded-file | mailx -s "tralala" recipient

wollie


0

Response Number 5
Name: tvc
Date: October 23, 2009 at 09:02:48 Pacific
Reply:

man mail

... would be the first thing to try. The internet does not know what OS you are running, it will all kind of options you cannot use on your copy


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon





Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: How to attach a file in a mail (UNIX script)

How to write a korn shell script www.computing.net/answers/unix/how-to-write-a-korn-shell-script/3643.html

how to read a file www.computing.net/answers/unix/how-to-read-a-file/8202.html

How to generate xls file in unix www.computing.net/answers/unix/how-to-generate-xls-file-in-unix/5629.html