[Xitami] mailing on NT

xitami@lists.xitami.org xitami@lists.xitami.org
Tue, 5 Jun 2001 12:28:11 +0200


On 4 Jun 2001, at 18:54, Francis Turner wrote:

> 
> 
> Dragonballz Insane wrote:
> 
> > I had a question on a perl program, I was trying to
> > figure out how to use a form which the user puts info
> > onto a html page and then sends it through perl.  I
> > need to know if Xitami has a sendmail program or what
> > I should use to fix the $mailprog = '/usr/lib/sendmail'
> 
> Xitam does not have a built-in sendmail program.
> 
> 
..or you try blat:

package Blat;
use strict;
my($mailer, $server, $Subject, $From, $To, $message);
$server =  "somemailer";# o.s.e
$Subject = "testing blat";
$From = "you\@somewhere.net";
$To = "to\@somewhere.net";
$message = "Hello blat !";
$mailer = "blat - -server $server -f $From -t $To -s \"$Subject\"";
$ENV{"TMP"} = "C:\\TEMP";
open (MAIL, "|$mailer ")or die "Oh shit: $!";
print MAIL $message;
close (MAIL);
=cut
Blat v1.8.2b: WinNT/95 console utility to mail a file via SMTP
by P.Mendes, M.Neal, G.Vollant, T. Charron
  http://www.interlog.com/~tcharron/blat.html
syntax:
  Blat <filename> -t <recipient> [optional switches (see below)]
  Blat -install <server addr> <sender's addr> 
[<try>[<port>[<profile>]]] [-q]
  Blat -profile [-delete | "<default>"] [profile1] [profileN] [-q]
  Blat -h [-q]

-install <server addr> <sender's addr> [<try n times> [<port> 
[<profile>]]]
     : set's SMTP server, sender, number of tries and port for profile
       (<try n times> and <port> may be replaced by '-').

<filename>     : file with the message body ('-' for console input, 
end with ^Z)
-t <recipient> : recipient list (comma separated)
-s <subj>      : subject line
-f <sender>    : overrides the default sender address (must be 
known to server)
-i <addr>      : a 'From:' address, not necessarily known to the 
SMTP server.
-c <recipient> : carbon copy recipient list (comma separated)
-b <recipient> : blind carbon copy recipient list (comma separated)
-o <organization>: Organization field
-h             : displays this help.
-q             : supresses *all* output.
-noh           : prevent X-Mailer header from showing homepage of 
blat
-noh2          : prevent X-Mailer header entirely
-p <profile>   : send with SMTP server, user and port defined in 
<profile>.
-server <addr> : Specify SMTP server to be used. (optionally, 
addr:port)
-port <port>   : port to be used on the server, defaults to SMTP (25)
-hostname <hst>: select the hostname used to send the message
-mime          : MIME Quoted-Printable Content-Transfer-Encoding.
-uuencode      : Send (binary) file UUEncoded
-base64        : Send (binary) file using base64 (binary Mime)
-try <n times> : how many time blat should try to send. from '1' to 
'INFINITE'
-attach <file> : attach binary file to message (may be repeated)
-attacht <file>: attach text file to message (may be repeated)

Note that if the '-i' option is used, <sender> is included in 'Reply-to:'
and 'Sender:' fields in the header of the message.
=end

...or you use MIME::Lite ; in this case adding and compressing an 
attachment:

package myMailTool;
use MIME::Lite;
use Cwd;
use strict;
my($dir,$path,$text,$msg,$From,$To,$Subject,$mailhost,$type,$su
ffix);
$mailhost = "somemailer";
$dir = shift;
$From = 'you@somewhere.net';
$To = 'to@somewhere.net';
$Subject = 'attachment';
$path = getcwd;
$type = 'application/octet-stream';
$text = "someText\n";
$suffix = "\.tar\.gz";
if(!$dir){die "Shit, no directory! $!"}
`tar cvf $dir.tar $dir`;
`gzip --best $dir.tar`;
MIME::Lite -> send('smtp', $mailhost, Timeout => 60);
$msg = MIME::Lite -> new(From => $From, To => $To, Subject => 
$Subject, Data => $text);
$msg -> attach(Type => $type, Path => "$path\/$dir$suffix ");
$msg -> send;
undef $msg;


yours,  Peter