NewsPro FAQ

NewsPro FAQ > Addons: Email >
How can I use the e-mail addon with BLAT on Windows NT?

 

The e-mail addon sends e-mail via a program called "sendmail", which is only available on UNIX systems. It is possible to edit the addon so that it works with a program called BLAT, available on NT systems.

WARNING: These modifications have been submitted by helpful users. They may not work, and they involve editing script files.

Two users have sent two different methods of doing this. Quite a few people have reported success with the first method, but the second method seems to work as well and is simpler as it doesn't involve creating temporary files.

Method 1

I modified the subroutine 'SendListEmail' in the file npa_email.pl thus:

#Note : all original variables from the Advanced settings are as in
# the original script
# A temporary file is created in c:\temp and then blat sends that
# so alter the path if you are working from elsewhere

sub SendListEmail {
local ($emailtext) = @_;
my ($NT_mail_program);
my ($NT_mail_params);

&LoadEmailList;
$emailbcc = join(',', @emaillist);

# Add Control Z to end of mail text and add to temporary file
$emailtext .= "©Z";
open(contents, ">> c:\temp\tmp$$");
print contents $emailtext;
close(contents);

# set up Blat and parameters

$NT_mail_program = $NPConfig{'SendmailPath'};
$NT_mail_params = " c:\temp\tmp$$ -f $NPConfig{'EmailFrom'} -t $NPConfig{'EmailTo'} -s \"News Update\" -b $emailbcc ";

# Execute blat

system($NT_mail_program $NT_mail_params);

}
# End of subroutine


Hope this helps

Owen Parry


Method 2

Edit npa_email.pl and replace the existing sub SendListEmail
seciton with the following:

sub SendListEmail {
local ($emailtext) = @_;
&LoadEmailList;
$emailbcc = join(',', @emaillist);
my $mailprog = $NPConfig{'SendmailPath'};
$mailprog =~ s/;//g;
$mailprog =~ s/[ \-]//g;
# open(MAILPROG, "|$mailprog -t") || &NPdie("Could not open $mailprog
to send e-mail.");
# print MAILPROG "To: $NPConfig{'EmailTo'}\n";
# print MAILPROG "From: $NPConfig{'EmailFrom'}\n";
# print MAILPROG "Reply-to: $NPConfig{'EmailFrom'}\n";
# print MAILPROG "Bcc: $emailbcc\n";
# print MAILPROG "Subject: $NPConfig{'EmailSubject'}\n\n";
# print MAILPROG $emailtext;
# close(MAILPROG);

my $mailoptions = qq! - -s "$NPConfig{'EmailSubject'}" -t
$NPConfig{'EmailTo'} !;
$mailoptions .= qq!-f $NPConfig{'EmailFrom'} -b $emailbcc!;

open(MAILPROG, "|$mailprog $mailoptions") || &NPdie("Could not open
$mailprog to send e-mail.");
print MAILPROG $emailtext;
close(MAILPROG);
}



 

Back to NewsPro FAQ