General
cancel
Showing results for 
Search instead for 
Did you mean: 

Scripted Email With Attachments *and* Nice Filename

Andrew Ratcliffe
Occasional Visitor

Scripted Email With Attachments *and* Nice Filename

Hi,

I need to send an email with an attachment. I need to do this from a thrid-party application, so I need a command-line solution.

I'm using elm and I can send the attachment but the recipient sees the attachment with a name such as "name010.bin". Is it possible to supply a name for the file?

I'm using the following [include] statement in the body of my elm message:

[include $HOME/testhtmldocument.html html/octet-stream base64]

I'd like the recipient to see it as testhtmldocument.html instead of name010.bin!

I'm not tied to elm, so if elm can't do this but another scriptable email client can, I'd be happy to use that other solution.

Thanks in anticipation...

-Andy
5 REPLIES
Chris Wilshaw
Honored Contributor

Re: Scripted Email With Attachments *and* Nice Filename

I normally go for

ux2dos name010.bin | uuencode testhtmldocument.html | mailx -m -s "attached file" you@where.you.are

Simon Hargrave
Honored Contributor

Re: Scripted Email With Attachments *and* Nice Filename

The best way would be to use mpack. You can get a HP-UX port from http://hpux.connect.org.uk.

This will MIME encode a file of your choice and send via e-mail.

I don't use Elm but I would guess that it uuencodes the file for transmission. You'll be better off using mpack to MIME encode, as some mail clients struggle with uuencoded files, and simply display the encoded text in the mail client.
Sundar_7
Honored Contributor

Re: Scripted Email With Attachments *and* Nice Filename


if U have sendmail of mailx

# uuencode name010.bin Nicefilename | /usr/lib/sendmail totheuser@user.com

Mailx

# uuencode name010.bin Nicefilename | mailx -s "Attachment" totheuser@user.com
Learn What to do ,How to do and more importantly When to do ?
Yogeeraj_1
Honored Contributor

Re: Scripted Email With Attachments *and* Nice Filename

hi,

I use the following in my scripts:

/usr/bin/uuencode $logfile "The Name of the File that I want.lis"|mailx -m -s "The subject i want on `date`" $emailadd1

Hope this helps!
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Andrew Ratcliffe
Occasional Visitor

Re: Scripted Email With Attachments *and* Nice Filename

Thanks all,

I subsequently found that the renaming was being done by the recipeint's mail server! However, your replies have taught me a lot and have been most useful.

Cheers

-Andy