Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

send mime attachments from command-line?

SOLVED
Go to solution
Trever Furnish
Regular Advisor

send mime attachments from command-line?

Anyone have a straightforward solution for attaching and sending multimedia files (such as PDFs) from the command line via email (non-interactively)?

HPUX includes elm and a (barebones) version of metamail, but not the mailto utility from metamail.

Elm doesn't seem to support attaching files to a message via the command-line unless you run it interactively.

Installed pine, works fine interactively, but doesn't seem to allow sending a message non-interactively.

Installed mutt, seems to work, but the attachments are corrupt.

Am I missing something? This shouldn't be this difficult. What do you use? Manually compiled metamail with mailto?

Suggestions?
Hockey PUX?
5 REPLIES
Pete Randall
Outstanding Contributor
Solution

Re: send mime attachments from command-line?

Chris Vail
Honored Contributor

Re: send mime attachments from command-line?

This one is pretty easy. Use the default MUA mailx, and uuencode. The command is: uuencode /path/file /path/file|mailx -s "Subject" me@myaddy.com

This will attach your file and mail it. We use both mutt and mailx as our MUA, and both work pretty well.

Chris
Uday_S_Ankolekar
Honored Contributor

Re: send mime attachments from command-line?

use uuencode..

uuencode filetobattached filename | sendmail emailid.

Suppose you want attach a pdf file from /home/dir to abc@xyz.com

uuencode /home/dir/filename.pdf filename.pdf | sendmail abc@xyz.com

-USA..
Good Luck..
Rita C Workman
Honored Contributor

Re: send mime attachments from command-line?

There are a few ways this can be done....

Here's a thread that my give you enough options to try:

http://forums.itrc.hp.com/cm/QuestionAnswer/0,,0x41950559ff7cd4118fef0090279cd0f9,00.html

Rgrds,
Rita
Trever Furnish
Regular Advisor

Re: send mime attachments from command-line?

Thanks, all!

Ten points to Pete for being the first to link to something that mentioned [include] for elm. Rita, yours would have gotten me there too, but Pete beat ya to it. But your link included mpack, another option - thanks!

For those suggesting uuencode, thanks, but I should have been more specific. Uuencoding is not quite enough for this app because only a small subset of clients will still seamlessly decode it.
Hockey PUX?