> On 2005-04-02 14:08, "Colin J. Raven" <[EMAIL PROTECTED]> wrote:
>> Does anyone happen to know how you would *attach* *not readin the
>> contents of, but actually *attach*) a file using /usr/bin/mail?
>
> Not very easily, is one answer.  You can probably get away with uuencode
> output filtered to the standard input of mail(1), but that's not really
> a "MIME attachment".

Okay, if you really want to use mail, here is what a mail message
(suitable for sending through /usr/bin/mail looks like when it has a
UUEncoded attachement. Technically you are supposed to MIME-Encode the
attachment but pretty much every mail client that supports attachments
will read a UUEncoded attachment.

From: "System Administrator"<[EMAIL PROTECTED]>
To: "test user"<[EMAIL PROTECTED]>
Subject: Testing mail attachments.
Content-Type: multipart/mixed;
        boundary="This_can_not_match_any_other_line_in_the_message"
MIME-Verion: 1.0

--This_can_not_match_any_other_line_in_the_message
Content-Transfer-Encoding: quoted-printable
Content-type: text/plain

Hi, Attached is a simple text file to test multi-part sending. The file was
originally called sample.txt and was created on a SUN system.

Notice the string specified in the boundary="..." bit in the headers. That
string should not occur anywhere in the body except as part of the mime
part delimitters.

--This_can_not_match_any_other_line_in_the_message
Content-Transfer-Encoding: x-uuencode
Content-Type: text/plain;
        name="sample.txt"
Content-Disposition: attachment;
        filename="sample.txt"

begin 644 sample.txt
M5&AI<R!I<R!A('-A;7!L92!F:6QE('[EMAIL PROTECTED];"!B92!U=65N8V]D960@
M=&[EMAIL PROTECTED]@9&5L:79E<F5D(&%S(&%N(&4M;6%I; IA='1A8VAM96YT+B!)="!I
M<RP@;V)V:6]U<VQY(&[EMAIL PROTECTED]&5X="!F:[EMAIL 
PROTECTED]&AI<R!S:&]U;&[EMAIL PROTECTED]@=&AE
.(&9O=7)T:"!L:[EMAIL PROTECTED]@

end

--This_can_not_match_any_other_line_in_the_message--

You use it like this:

/usr/bin/mail [EMAIL PROTECTED] < mail_with_attachment.txt

Obviously, you will have to uuencode your own attachment and replace the
one from the example.

>
>> On my system mail has no "-a" (attach) flag, and some Googling told me
>> mailx might solve the problem, but /usr/bin/mailx just invokes mail....
>
> Other mail user agents do have a -a flag though.  At least mail/mutt
> does and I've used it successfully in the past.  If you are not stuck
> with mail(1) only, you can always use mutt for this.
>
>       mutt -a /path/to/file [EMAIL PROTECTED]
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "[EMAIL PROTECTED]"
>


-- 
Ean Kingston
    E-Mail: ean_AT_hedron_DOT_org
 PGP KeyID: 1024D/CBC5D6BB
       URL: http://www.hedron.org/


_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to