Dear John, I've received the following wishlist request for swaks: On 2006-02-23 Marc Haber <[EMAIL PROTECTED]> wrote: > Package: swaks > Version: 0+20050625.8-1 > Severity: wishlist
> Hi, > please add an option to just read the message body from stdin, while > message headers are still generated by swaks. > This would enable things like > < eicar.com swaks --to [EMAIL PROTECTED] > to quickly test virus scanners. I have also missed that once or twice, too (for gtube or eicar). Attached is a patch for ---- -b, --body Message body to be used instead of the default 'This is a test message'. ---- however it does not support reading '-' for reading from stdin, I did not want to butcher swaks with my weak perl-foo. ;-) thanks, cu andreas -- The 'Galactic Cleaning' policy undertaken by Emperor Zhark is a personal vision of the emperor's, and its inclusion in this work does not constitute tacit approval by the author or the publisher for any such projects, howsoever undertaken. (c) Jasper Ffforde
--- /usr/bin/swaks 2005-06-26 08:21:45.000000000 +0200 +++ swaks 2006-02-25 16:45:35.385234456 +0100 @@ -42,6 +42,7 @@ 'h|helo|ehlo:s' => \$O{mail_helo}, # (h)elo string 's|server:s' => \$O{mail_server}, # (s)erver to use 'p|port:i' => \$O{mail_port}, # (p)ort to use + 'b|body:s' => \$O{body}, # override message body text ('\n' for newlines) 'd|data:s' => \$O{mail_data}, # (d)ata portion ('\n' for newlines) 'timeout:s' => \$O{timeout}, # timeout for each trans (def 30s) 'g' => \$O{data_on_stdin}, # (g)et data on stdin @@ -967,10 +968,12 @@ $n{data} = $o->{mail_data} || interact("Data: ", '^.*$'); } } + $n{body} ||= $o->{body} + || 'This is a test mailing'; $n{data} ||= $fconf->{DATA} || 'Date: %D\nTo: %T\nFrom: %F\nSubject: test %D\n' ."X-Mailer: swaks v$p_version jetmore.org/john/code/#swaks".'\n\n' - .'This is a test mailing\n'; + ."$n{body}".'\n'; # The -g option trumps all other methods of getting the data $n{data} = join('', <STDIN>) if ($o->{data_on_stdin}); if (!$o->{no_data_fixup}) { @@ -1189,6 +1192,10 @@ Use argument as argument to SMTP EHLO/HELO command, or prompt use if no argument is specified. Overridden by -l token HELO. If unspecified, swaks uses best guess at DNS hostname of local host. +=item -b, --body + +Message body to be used instead of the default 'This is a test message'. + =item -d, --data Use argument as DATA portion of SMTP transaction, or prompt user if no argument specified. Overridden by -l token DATA.