I have tried various ways to send an attachment via elm using command line only.
I am generating various html files with various configs of our servers. I want to then email these to my offsite mail server to have a copy of my server configs off site.
Can someone tell me how to send the attachments through elm (or any other method) that can be coded into my collect scripts.
Note: If you are the author of this question and wish to assign points to any of the answers, please login first.For more information on assigning points ,click
here
Try;
uuencode [filename] [name you want for attachment] | sendmail xyz@abc.com
To send text attachments via elm or mutt from the command line, you would:
1. Edit the file and preceding the actual text add the following line:
[include text.txt text/plain base64]
The general format is: [include filename type/subtype encoding]
type/subtype= text/plain, image/gif, image/jgp etc..
encoding=base64, quoted-printable etc...
2. To send the mail and attachment with elm:
elm -s 'Testing' "recipient's email address" < test.txt
I use the include method, but you need to make sure you are using a current copy of elm. THe last patches I installed for some reason disable my ability to attach - something I have been doing for many moons. I had to revert back to the previous version, which for me is 10.20 HP/UX and elm version 1.206.214.2
I set this up here when the developers wanted a way to send reports via email (and use HPUX to send other file attachements...even if it was an Excel/Word file or image
file giff,tiff, etc..) They took this vehicle and included it straight into their job streams and set up their include files for whatever they needed...They tell me it works....Here it
is - I hope it helps you !
*******************************************
if your trying to attach a file and send the file via sendmail as an attachment than you can do this also.
First make sure you at least have Elm 2.4 on your box, and my example is for a HPUX 10.2 (you need MIME capability) so be sure you have patch PHNE_15835 (it doesn't cause a reboot to load). To give you an example I ftp'd an excel spreadsheet to my box called test.xls Then I did the following:
First create a dummy file with the following line (just as you see it here)
[include test.xls application/msexcel base64]
Second from the command line:
elm -s "This is a test" user@hp.com <dummy
============================================
What this did was email to user@hp.com the file test.xls (and it comes as attached excel file) with a subject line of This is a test.
You can do it with text files; image.jpg or gif files; and more. It's a very handy tool that programmers can add right into the job streams and email reports to users instead of
printing them....makes for paperless environment.
Here's an example for a simple text file:
.. just change your include to read something like this:
[include error.file text/plain base64]
If you've lost the ability to send via 'include' check your patches.....I will bet you have PHNE_20505 loaded.
Remove this patch and then re-install PHNE_15835 (even it's already there-reload it).
I ran into the same problem and found out this is a patch that is part of one of the general release bundles....
On HPUX 11.00 the elm version to support attachments is 2.4 . and u can use the command :
elm - s ( SUBJECT ) addresss < file name . We also have 3rd party programs like mpack which do the same thing , and are simple to setup and use . MPACK is one of them you can down load the bin file from the site : ftp://ftp.andrew.cmu.edu/pub/mpack
and run it to send the mail attachments . This is more simpler than elm setup as you can just down laod the bin file and put it in the bin directory .
also the command to be used to send the file is
mpack -s "Subject " <Filename to be attached> addresss.
In case you have problems in download I can send the mpack bin file as an attachment.