Re: Attachments with email from command line?

2008-10-10 Thread chas
 Victor Duchovni a écrit :
 On Thu, Oct 09, 2008 at 03:45:04PM -0400, James wrote:


 http://www.unix.com/how-do-i-send-email/


 I would download mpack(1)/munpack(1) from CMU. The code is old and
 one needs to remove a couple of spurious declarations of malloc() on
 some systems.

 With mpack it is easy to send MIME encoded attachments. To adjust the
 From line post-process output of mpack -o to create a suitable
 From: header.



 or use Perl.

 use MIME::Lite;

 my $msg = MIME::Lite-new(
 From= '[EMAIL PROTECTED]',
 To  = '[EMAIL PROTECTED]',
 Cc  = '[EMAIL PROTECTED], [EMAIL PROTECTED]',
 Subject = 'blah blah',
 Type= 'multipart/mixed'
 );

 $msg-attach(
 Type = 'TEXT',
 Data = blah blah blah blah
 );

 $msg-attach(
 Type = '|application/vnd.ms-excel|',
 Path = '/path/to/foo.xls',
 Filename = 'foo.xls',
 Disposition = 'attachment'
 );

 $msg-send;


Thanks to everyone who replied for all the useful suggestions. I'm going
to read the links posted and possibly try the Perl suggestion first.

thanks again,
Chas.



Re: Attachments with email from command line?

2008-10-10 Thread Jan P. Kessler

What about simply using uuencode?

( echo Text ; uuencode origname.gz attname.gz ) \
| mailx -s subject -r [EMAIL PROTECTED] [EMAIL PROTECTED]




Re: Attachments with email from command line?

2008-10-10 Thread Victor Duchovni
On Fri, Oct 10, 2008 at 02:25:58PM +0200, Jan P. Kessler wrote:

 
 What about simply using uuencode?
 
 ( echo Text ; uuencode origname.gz attname.gz ) \
 | mailx -s subject -r [EMAIL PROTECTED] [EMAIL PROTECTED]

uuencode is obsolete. MIME has been around since the mid-late 90's. New
applications should not use uuencode.

-- 
Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
mailto:[EMAIL PROTECTED]

If my response solves your problem, the best way to thank me is to not
send an it worked, thanks follow-up. If you must respond, please put
It worked, thanks in the Subject so I can delete these quickly.


Re: Attachments with email from command line?

2008-10-10 Thread Jan P. Kessler
Victor Duchovni schrieb:
 On Fri, Oct 10, 2008 at 02:25:58PM +0200, Jan P. Kessler wrote:

   
 What about simply using uuencode?

 ( echo Text ; uuencode origname.gz attname.gz ) \
 | mailx -s subject -r [EMAIL PROTECTED] [EMAIL PROTECTED]
 

 uuencode is obsolete. MIME has been around since the mid-late 90's. New
 applications should not use uuencode.
   

additionally i was not able to find it anywhere except on our old
solaris boxes.

sorry for the noise,
  jan (awakened from the middle ages)



Re: Attachments with email from command line?

2008-10-09 Thread James
On Thu, October 9, 2008 3:40 pm, [EMAIL PROTECTED] wrote:
 Hello,
 I'm currently sending 2 daily emails to my group at work using crontab
 and the '/usr/lib/sendmail' command on a server running postfix 2.5.1. Is
 there any way to add an attachment, in this case a excel spreadsheet? I've
 had people tell me to use mutt but I'm having trouble changing the 'from'
 header in mutt. I would like to use the sendmail command (through postfix)
 if possible.

 thanks, Chas.



http://www.unix.com/how-do-i-send-email/



Re: Attachments with email from command line?

2008-10-09 Thread Victor Duchovni
On Thu, Oct 09, 2008 at 03:45:04PM -0400, James wrote:

 http://www.unix.com/how-do-i-send-email/

I would download mpack(1)/munpack(1) from CMU. The code is old and
one needs to remove a couple of spurious declarations of malloc() on
some systems.

With mpack it is easy to send MIME encoded attachments. To adjust the
From line post-process output of mpack -o to create a suitable
From: header.

-- 
Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
mailto:[EMAIL PROTECTED]

If my response solves your problem, the best way to thank me is to not
send an it worked, thanks follow-up. If you must respond, please put
It worked, thanks in the Subject so I can delete these quickly.


Re: Attachments with email from command line?

2008-10-09 Thread mouss
Victor Duchovni a écrit :
 On Thu, Oct 09, 2008 at 03:45:04PM -0400, James wrote:

   
 http://www.unix.com/how-do-i-send-email/
 

 I would download mpack(1)/munpack(1) from CMU. The code is old and
 one needs to remove a couple of spurious declarations of malloc() on
 some systems.

 With mpack it is easy to send MIME encoded attachments. To adjust the
 From line post-process output of mpack -o to create a suitable
 From: header.

   

or use Perl.

use MIME::Lite;

my $msg = MIME::Lite-new(
From= '[EMAIL PROTECTED]',
To  = '[EMAIL PROTECTED]',
Cc  = '[EMAIL PROTECTED], [EMAIL PROTECTED]',
Subject = 'blah blah',
Type= 'multipart/mixed'
);

$msg-attach(
Type = 'TEXT',
Data = blah blah blah blah
);

$msg-attach(
Type = '|application/vnd.ms-excel|',
Path = '/path/to/foo.xls',
Filename = 'foo.xls',
Disposition = 'attachment'
);

$msg-send;




Re: Attachments with email from command line?

2008-10-09 Thread Uwe Dippel

mouss wrote:


or use Perl.

use MIME::Lite;

my $msg = MIME::Lite-new(
From= '[EMAIL PROTECTED]',
To  = '[EMAIL PROTECTED]',
Cc  = '[EMAIL PROTECTED], [EMAIL PROTECTED]',
Subject = 'blah blah',
Type= 'multipart/mixed'
);

$msg-attach(
Type = 'TEXT',
Data = blah blah blah blah
);

$msg-attach(
Type = '|application/vnd.ms-excel|',
Path = '/path/to/foo.xls',
Filename = 'foo.xls',
Disposition = 'attachment'
);

$msg-send;




Thanks,

you were faster than me, I was already starting to devise some in shell 
script.


Aside of hacks, I *think* that it might make sense to have a non-hacked 
solution. As system administrators, we, at least I, send quite a number 
of items with mail (cronjobs).
Therefore, IMHVHO, a tool distributed with *nix or *fix (wrapping around 
mail) might be useful?


Uwe




Re: Attachments with email from command line?

2008-10-09 Thread MrC
Uwe Dippel wrote:

 Aside of hacks, I *think* that it might make sense to have a non-hacked
 solution. As system administrators, we, at least I, send quite a number
 of items with mail (cronjobs).
 Therefore, IMHVHO, a tool distributed with *nix or *fix (wrapping around
 mail) might be useful?
 
 Uwe

man mutt nail

NAME
   mutt - The Mutt Mail User Agent

SYNOPSIS
   mutt [-nRyzZ] [-e cmd] [-F file] [-m type] [-f file]

   mutt  [-nx]  [-e  cmd]  [-a  file] [-F file] [-H file] [-i
   file] [-s subj] [-b addr] [-c addr] addr [...]

   mutt [-n] [-e cmd] [-F file] -p

   mutt -v[v]

DESCRIPTION
   Mutt is a small but very powerful text based  program  for
   reading  electronic  mail  under  unix  operating systems,
   including support color terminals, MIME,  and  a  threaded
   sorting mode.

OPTIONS
   -a file
  Attach a file to your message using MIME.

...

Name

nail - send and receive Internet mail
Synopsis

nail [-BDdFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b
bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]]
to-addr . . .

nail [-BDdeHiInNRv~] [-T name] [-A account] [-S variable[=value]] -f [name]
nail [-BDdeinNRv~] [-A account] [-S variable[=value]] [-u user]

Description

Nail is an intelligent mail processing system, which has a command
syntax reminiscent of ed(1) with lines replaced by messages. It is based
on Berkeley Mail 8.1, is intended to provide the functionality of the
POSIX nail command, and offers extensions for MIME, IMAP, POP3, SMTP,
and S/MIME. Nail provides enhanced features for interactive use, such as
caching and disconnected operation for IMAP, message threading, scoring,
and filtering. It is also usable as a mail batch language, both for
sending and receiving mail.

The following options are accepted:

-A name
Executes an account command (see below) for name after the startup
files have been read.

-a file
Attach the given file to the message.