mail attachment from commandline
Hi everybody, How can I mail an attachment with either the sendmail (from postfix) or mail (from mailx) command? The relevant man pages don't mention attachments, but I'm sure there's some fancy piping or something that would allow this. Can anyone point me in the right direction? Thank you -- Hans du Plooy Newington Consulting Services hansdp at newingtoncs dot co dot za
Hans du Plooy wrote:
Hi everybody,
How can I mail an attachment with either the sendmail (from postfix) or mail (from mailx) command? The relevant man pages don't mention attachments, but I'm sure there's some fancy piping or something that would allow this. Can anyone point me in the right direction?
Hans, see the "-a" option for mail/nail. /Per Jessen, Zurich
Hi Hans,
Hi everybody,
How can I mail an attachment with either the sendmail (from postfix) or mail (from mailx) command? The relevant man pages don't mention attachments, but I'm sure there's some fancy piping or something that would allow this.
[ snip ] you might want to try this: uuencode filename filename | mailx -s "your subject here" foo@domain.com The double "filename" is not a typo. The first one is the real filename and the second is how you want to name the uuencoded one. HTH, Martin
On Wednesday 25 February 2004 16:56, Martin Mielke wrote:
you might want to try this:
uuencode filename filename | mailx -s "your subject here" foo@domain.com
The double "filename" is not a typo. The first one is the real filename and the second is how you want to name the uuencoded one.
Thanks Martin, that did it! -- Hans du Plooy Newington Consulting Services hansdp at newingtoncs dot co dot za
Hi again,
On Wednesday 25 February 2004 16:56, Martin Mielke wrote:
you might want to try this:
uuencode filename filename | mailx -s "your subject here" foo@domain.com
The double "filename" is not a typo. The first one is the real filename and the second is how you want to name the uuencoded one.
Thanks Martin, that did it!
you are welcome! :) [ snip ] One thing I still haven't done: compose an email with both text in the body and a file attached... I should go for some MIME-stuff but got to find the time... Maybe somebody has done this already and wants to share their experiences... ? Regards, Martin
Am Mittwoch, 25. Februar 2004 16:30 schrieb Martin Mielke:
One thing I still haven't done: compose an email with both text in the body and a file attached... I should go for some MIME-stuff but got to find the time...
Maybe somebody has done this already and wants to share their experiences... ?
sure.. echo "some text" | mutt -a file -s "my subject" recipient@domain.com Andreas
Hallo Andreas,
Am Mittwoch, 25. Februar 2004 16:30 schrieb Martin Mielke:
One thing I still haven't done: compose an email with both text in the body and a file attached... I should go for some MIME-stuff but got to find the time...
Maybe somebody has done this already and wants to share their experiences... ?
sure..
echo "some text" | mutt -a file -s "my subject" recipient@domain.com
This is not a valid solution, at least for me, as this is achieved through non-standard UNIX commands. If you don't have mutt installed you are lost... Martin
On Thu, 2004-02-26 at 01:42, Martin Mielke wrote:
Hallo Andreas,
Am Mittwoch, 25. Februar 2004 16:30 schrieb Martin Mielke:
One thing I still haven't done: compose an email with both text in the body and a file attached... I should go for some MIME-stuff but got to find the time...
Maybe somebody has done this already and wants to share their experiences... ?
sure..
echo "some text" | mutt -a file -s "my subject" recipient@domain.com
This is not a valid solution, at least for me, as this is achieved through non-standard UNIX commands. If you don't have mutt installed you are lost...
man nail. Remember, man -k is your friend. -- ---------------------------------------------------------------------- Patrick Greenwell SUSE LINUX, 1100 Sansome St., San Francisco, CA, 94111 T: +1 415 591 6607 - Cell: +1 510 499 7896 F: +1 415 591 6619 - patrick@suse.com ----------------------------------------------------------------------
This is not a valid solution, at least for me, as this is achieved through non-standard UNIX commands. If you don't have mutt installed you are lost...
man nail.
Remember, man -k is your friend.
I guess you haven't read my second post on this subject... Martin
The Wednesday 2004-02-25 at 16:30 +0100, Martin Mielke wrote:
Maybe somebody has done this already and wants to share their experiences...
As more than one said on this thread, man mailx (in fact, nail): -a file Attach the given file to the message. -- Cheers, Carlos Robinson
Hola Carlos,
The Wednesday 2004-02-25 at 16:30 +0100, Martin Mielke wrote:
Maybe somebody has done this already and wants to share their experiences...
As more than one said on this thread, man mailx (in fact, nail):
-a file Attach the given file to the message.
-- Cheers, Carlos Robinson
Again, nail is an invalid option for me, as this is a non-standard UNIX command. It could be under Linux (by default?) but it's not, for example, on Solaris 9 - although you could compile it... Funny thing from http://omnibus.ruf.uni-freiburg.de/~gritter/ (nail's author?): --- Note: I develop free software. I don't support it. If you have problems using or administering my software and received it from a third party, please make at least sure that you have the latest version before contacting me. If you are unable to do this, don't ask me but buy support from your system or distribution vendor. --- Martin
The Thursday 2004-02-26 at 10:48 +0100, Martin Mielke wrote:
As more than one said on this thread, man mailx (in fact, nail):
Again, nail is an invalid option for me, as this is a non-standard UNIX command. It could be under Linux (by default?) but it's not, for example, on Solaris 9 - although you could compile it...
Er... but this is a linux list. Previously, we had "mail", and I had to get and compile "nail" separately. Now (suse 8.2), both mail and mailx are a symlink to nail: cer@nimrodel:~/Mail> l /usr/bin/mail /usr/bin/mailx lrwxrwxrwx 1 root root 4 2003-07-12 14:27 /usr/bin/mail -> nail* lrwxrwxrwx 1 root root 4 2003-07-12 14:27 /usr/bin/mailx -> nail* (same for 'Mail') And the original mail and mailx command have dissapeared from the distro. In fact, the mailx rpm has this description: Packager : http://www.suse.de/feedback Summary : A MIME capable implementation of the mailx command Description : Nail is a mail user agent derived from Berkeley Mail 8.1. It is intended to provide the functionality of the POSIX.2 mailx command with additional support for MIME messages, POP3, and SMTP. In recent system environ ments, nail is Unicode/UTF-8 capable. It further contains some minor enhancements like the ability to set a From: Address.
Funny thing from http://omnibus.ruf.uni-freiburg.de/~gritter/ (nail's author?):
Yes, Gunnar Ritter.
--- Note: I develop free software. I don't support it. If you have problems using or administering my software and received it from a third party, please make at least sure that you have the latest version before contacting me. If you are unable to do this, don't ask me but buy support from your system or distribution vendor.
:-) Yes, I remember that note. Ah, if you want it for non-linux machines, read on: |It should generally be possible to build nail on most Unix-style |systems without much effort; however, especially the character set |support varies between them. See the file "I18N" for details. -- Cheers, Carlos Robinson
On Thursday 26 February 2004 01:32, Carlos E. R. wrote:
-a file Attach the given file to the message.
All right, I found out why it doesn't work. mailx in SuSE 8.0 doesn't have the -a option. 9 does... -- Hans du Plooy Newington Consulting Services hansdp at newingtoncs dot co dot za
On Thu, 26 Feb 2004 15:47:03 +0200
Hans du Plooy
All right, I found out why it doesn't work. mailx in SuSE 8.0 doesn't have the -a option. 9 does...
This is because starting from version 9.0, the mail command is actually nail. The pristine mail command is not capable of mime attachments. Charles -- "MSDOS didn't get as bad as it is overnight -- it took over ten years of careful development." (By dmeggins@aix1.uottawa.ca)
On Friday 27 February 2004 01:36, Charles Philip Chan wrote:
All right, I found out why it doesn't work. mailx in SuSE 8.0 doesn't have the -a option. 9 does...
This is because starting from version 9.0, the mail command is actually nail. The pristine mail command is not capable of mime attachments.
Oh, thanks. That explains it. I thought mail was a symlink to mailx on both. Thanks -- Hans du Plooy Newington Consulting Services hansdp at newingtoncs dot co dot za
The Thursday 2004-02-26 at 15:47 +0200, Hans du Plooy wrote:
On Thursday 26 February 2004 01:32, Carlos E. R. wrote:
-a file Attach the given file to the message.
All right, I found out why it doesn't work. mailx in SuSE 8.0 doesn't have the -a option. 9 does...
The command "mail" is now a symlink to "nail". Original "mail" wasn't, and did not have that capacity. SuSE 8.1 had the original mail, and 8.2 has nail instead... Come to think of it, I wonder if this change came after I asked the same question here, how to send attaches from a command line, and a poster told me to use nail instead (which I had to compile from sources) then: |Date: Tue, 13 May 2003 15:32:06 -0400 |From: Charles Philip Chan |To: suse-linux-e@suse.com |Subject: Re: [SLE] command line mail |X-Message-Number-for-archive: 145199 I'm guessing that somebody at SuSE took the idea on :-) Ouch! And this reminds me! I still have nail in "/usr/local/bin/". I forgot to remove it (my local compiled copy from suse 8.1). Done. -- Cheers, Carlos Robinson
participants (7)
-
Andreas Stieger
-
Carlos E. R.
-
Charles Philip Chan
-
Hans du Plooy
-
Martin Mielke
-
Patrick Greenwell
-
Per Jessen