Subject: | mimesend tweaks |
Please find enclosed a patch to make the sample mimesend script a little
more useful out of the box. It:
1) Removes a duplicate definition of GIF MIME-type
2) Includes a MIME-type for PDF
3) Clarifies documentation
4) Adds support for reading a single attachment from STDIN
Subject: | mimesend.patch |
--- /opt/src/CPAN/build/MIME-tools-5.427/examples/mimesend 2007-08-29 09:36:44.000000000 -0400
+++ /usr/local/bin/mimesend 2009-07-20 18:26:30.000000000 -0400
@@ -12,8 +12,8 @@
-n Don't actually send it; just print it to stdout.
-t to The "to" address.
-s subj The subject of the message.
- -f file Path to attached file.
- -m type MIME type of last -f file.
+ -f file Path to attached file, or - for STDIN.
+ -m type MIME type of previous -f; therefore -m must follow -f.
For example:
@@ -41,10 +41,10 @@
jpg image/jpeg
jpeg image/jpeg
gif image/gif
- gif image/gif
tif image/tiff
tiff image/tiff
xbm image/xbm
+ pdf application/pdf
);
# Usage:
@@ -113,7 +113,7 @@
# Build:
$top = build MIME::Entity
Type => ($type || type_for($path)),
- Path => $path,
+ $path eq '-' ? (Data => [<>]) : (Path => $path),
Encoding => '-SUGGEST';
$top->head->add('To', $to);
$top->head->add('Subject', $subj);