Gossamer Forum
Home : Products : DBMan : Customization :

Sending email on NT

Quote Reply
Sending email on NT
If I want to send an email notice after someone adds a new record, it's very easy for Unix. In db.cgi, in sub add_record {, afer &html_add_success; you would add:
Quote:
open (MAIL, "|/usr/lib/sendmail -t") or &cgierr("can't get to sendmail. reason: $!");
print MAIL "To: you\@yourdomain.com\n";
print MAIL "From: "$in{'Email'}\n";
print MAIL "Subject: Subject goes here\n\n";
print MAIL "$in{'Name'} wrote: \n";
print MAIL "Domain: $in{'Domain'}\n";
print MAIL "Description: $in{'Description'}\n";
close MAIL;

Now the big question is, how can you do it with NT? Seems like everyone is saying you have to install this or you have to install that. Links can do it, this UBB can do it, and they don't require anything to be installed on the NT server.

I think many people are interested in this topic. If anyone knows how to do it exactly, please let us know.

[This message has been edited by Katana Man (edited February 22, 1999).]
Quote Reply
Re: Sending email on NT In reply to
Hi Katana Man
I'm working on a NT server and I can send my e-mails with BLAT.EXE. If on your server also BLAT is installed, what usually is, then you can use this code in your script. Because on my server the path is set to
the program I must not enter a path to BLAT, ask yor ISP.

Code:
$WIN_TEMPFILE="d:\\real\\path\\to\\your\\file\\mail.$$";
$mailprog = 'blat.exe';
$recipient = 'rene.kurt@schapendoes.ch';

open(MAIL,">$WIN_TEMPFILE");
local($BLAT_ARGS);

print MAIL "Subject: Type the subject here\n\n";
print MAIL "Type what you want have in the e-mail\n\n";
close (MAIL);

$WIN_TEMPFILE =~ s/\//\\/g;
$mailprog =~ s/\//\\/g;
$BLAT_ARGS = "$WIN_TEMPFILE -t $recipient -penguin ";
$BLAT_ARGS .= "-f sendersname ";
$BLAT_ARGS .= "-q";
system "$mailprog $BLAT_ARGS";
unlink $WIN_TEMPFILE;


Hope this helps
Rene
Quote Reply
Re: Sending email on NT In reply to
Well thank you, but that doesn't help. They don't have BLAT. What about SMTP sockets or JMAIL, anyone know the syntax to be used ?



[This message has been edited by Katana Man (edited February 22, 1999).]
Quote Reply
Re: Sending email on NT In reply to
Hello again

For a sample check
http://www.perlfect.com/freescripts
look into the file which you can find under
MassMailer / Source for Win95/NT
Quote Reply
Re: Sending email on NT In reply to
Download Links 2 and copy the Mailer.pm file over into your DBMan directory. Then change your mail routine to:

Code:
my $mailer = new Mailer ( { smtp => 'name.of.smtp.host' } ) or die "Can't
init mailer: $Mailer::error";
$mailer->send ( {
to => 'you@yourdomain.com',
from => $in{'Email'},
subject => "Subject goes here",
msg => $body_text
} ) or die "Can't send mail: $Mailer::error";

and make sure to set $body_text to the contents of the body.

Hope that helps,

Alex
Quote Reply
Re: Sending email on NT In reply to
Wehooooooooo!!!

It works. But don't forget you have to add
require db_script_path . "/Mailer.pm";

in the default.cfg

Thanks a ton Alex!
Quote Reply
Re: Sending email on NT In reply to
Hey Alex,

Is there anyway to use Mailer.pm to cc someone?

For example, I tried

to => $rec{'Email'},
to => 'me@myname.com',

Which sent email to me@myname.com and ignored the $rec{'Email'}.

I know that
to => 'me@myname.com,you@yourname.com',

works fine, but when you try
to => 'me@myname.com,$rec{'Email'}',
I get errors.

Any ideas ?
Thanks



[This message has been edited by Katana Man (edited March 06, 1999).]
Quote Reply
Re: Sending email on NT In reply to
Hi,

Try adding:

headers => 'CC: somebody@somewhere.com'

to the list of parameters..

Cheers,

Alex

Quote Reply
Re: Sending email on NT In reply to
I'm still stuck on this Alex, any ideas ?
Quote Reply
Re: Sending email on NT In reply to
Hmmm... nope Frown

I added this numerous ways to the .cgi file, but it just ignores it and only sends to the to: address.

I looked in the Mailer.pm and saw nothing that referenced CC's, there is only:
To: From: Reply: and Subject:


[This message has been edited by Katana Man (edited March 22, 1999).]
Quote Reply
Re: Sending email on NT In reply to
Any thoughts Alex ?
Quote Reply
Re: Sending email on NT In reply to
Well the quickest/easiest way is to just send the mail twice:

Code:
$mailer->send ( {
to => 'you@yourdomain.com',
from => $in{'Email'},
subject => "Subject goes here",
msg => $body_text
} ) or die "Can't send mail: $Mailer::error";

$mailer->send ( {
to => 'anotherone@yourdomain.com',
from => $in{'Email'},
subject => "Subject goes here",
msg => $body_text
} ) or die "Can't send mail: $Mailer::error";

I'd have to look into why the CC isn't working. It might mean reworking sub send_smtp to get it to work. The above should be a quick fix.

Cheers,

Alex
Quote Reply
Re: Sending email on NT In reply to
I have tried and tried installing Blat.exe on our NT server, but it does not work. I keep getting fatal errors when trying to execute sendmail programs.

Rene or anyone else who has successfully installed BLAT, please email me at eliot@anthrotech.com and let me know what you did. I did follow the instructions available at the BLAT download web site, but it still does not seem to work. I also have posted this problem on many other NT related message boards and listservs with no concrete answers.

(Yes, I know that I can download the Mailer.pm file from LINKS and use that to send email via the web. However, I would like to have a more robust method of sending email to multiple email addresses from multiple web forms, not just within the DBMAN system.)

TIA.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us