Gossamer Forum
Home : Products : Links 2.0 : Customization :

Blat as sendmail for Win NT

Quote Reply
Blat as sendmail for Win NT
I had problems usig the blat utility to send mail with NT servers so I modified the file mailer.pm
as follows and it works very well. It may be useful for people with the same problem..


##########################################################
sub send_sendmail {
# ---------------------------------------------------------------
#Envía un mensaje usando Blat como sendmail.

my $self = shift;
my $to = $self->{'to'};
my $from = $self->{'from'};
my $msg = $self->{'msg'};
my $subject = $self->{'subject'};
my $tempfile = shift;

BEGIN{ srand $$.time }
do {$tempfile = int (rand (99999999)) . ".bla"} until !(-e $tempfile);


open(OUTPUT, ">E:\\yourpath\\$tempfile") ||
&error("Error al escribir en el fichero temporal $tempfile");

print OUTPUT $msg;

close OUTPUT;

system ("blat E:\\yourpath\\$tempfile -s \"$subject\" -f $from -t $to");

$self->log_msg() or return undef;

return 1;
}

#################################################################
You have to put in the links.cfg file the path to blat (e.g. $db_mail_path = 'C:\\Winnt\\System32\\blat.exe';)

and choose for sub send_mail the path where you want to put the temp files..e.g. E:\\yourpath\\
(you can also use $db_script_path) for the admin directory..)

but now I am trying to delete the temp files (*.bla) from my directory ...I do not need them anymore..

any idea or suggestion about how to do it?

Thanks



Quote Reply
Re: Blat as sendmail for Win NT In reply to
Thanks for the tip...I am sure that it will help NT users. You might want to consider adding this to the FAQ section of LINKS 2.0 in the Resource Center, so that this information isn't lost in the Thread Shuffle. Wink

In Reply To:
but now I am trying to delete the temp files (*.bla) from my directory ...I do not need them anymore..
What temp files are you referring to???

Regards,


Eliot Lee
Quote Reply
Re: Blat as sendmail for Win NT In reply to
In order to use the system command for blat I write first a copy of the messages to be sent, in a temporary directory e.g. in \admin\bla\. My sub send_mail routine sends them but after this I would like to delete them...and I do not know how to do it..:-)

Quote Reply
Re: Blat as sendmail for Win NT In reply to
You could write a batch file that deletes those files and then use the NT Scheduler to periodically delete the files in that directory....Search the web for batch files delete. Technically, your question does not relate to LINKS...It is a general sendmail issue.

Also, here are some really good NT and Windows 2000 resources:

1) http://www.windows2000faq.com
2) http://www.xs4all.nl/~robw/rob/
3) http://www.winntmag.com/Support/
4) http://www.JSIINC.COM/reghack.htm

Good luck!

Regards,

Eliot Lee