View previous topic :: View next topic |
Author |
Message |
mikem22 -
Joined: 26 Oct 2007 Posts: 13
|
Posted: Fri Oct 26, 2007 7:30 pm Post subject: Perl and Windows server 2003 |
|
|
Hi,
I am in the process of transferring one of our domains to Windows 2003 from a UNIX based server.
I have some CGI that I need to import, but having big problems sending email..
The current script is
Quote: |
$recipient='me@there.com';
$sender = 'dummy12477@there.com' # to get around relaying issues
if (open(MAIL, "|$sendmail $sendmailFlags")) {
print MAIL "To: $pageOwner\n";
print MAIL "From: $sender\n";
print MAIL "Reply-To: $sender\n";
print MAIL "Subject: Quotation Request\n\n";
print MAIL "Request from: \n\n";
print MAIL "Contact: $contact \n";
print MAIL "eMail: $$FORM{'email'}; \n";
.....
Close MAIL;
};
|
I have installed Blat, QK SMTP server and Activestate 5.6 Perl and the scripts that dont use sendmail work fine. I searched through here and found some code for blat, but cant seem to get it to work..
Could anyone post a bit of code to;
Build the email
send it
Thanks in advance,
Mike _________________ Mike Montgomery |
|
Back to top |
|
|
aprelium-beta -
Joined: 24 Jun 2004 Posts: 383
|
Posted: Sat Oct 27, 2007 9:25 am Post subject: Re: Perl and Windows server 2003 |
|
|
mikem22,
There is no Sendmail application by default on Windows. So you'll have to download Blat which is a sendmail compatible tool on Windows and configure your script to use it (instead of sendmail).
Blat is available from http://www.blat.net/ . _________________ Beta Testing Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
mikem22 -
Joined: 26 Oct 2007 Posts: 13
|
Posted: Sat Oct 27, 2007 10:58 am Post subject: |
|
|
Hi, and thanks for looking ...
I have installed blat
I have also installed QK SMTP and this works fine in outlook express using localhost as SMTP server.
I used the following install for BLAT..
blat -install localhost from@mydomain.com 3 25 - username password
This was accepted with no errors.
3=Retries
25=Port
- Skip profiles
The CGI code uses the 'send mail' part of matts script and is as follows (just to test to get a 'sendmail' working)
Quote: |
#!/C:/Perl/bin/perl
$fileout="someurl.html";
$SMTP_SERVER="Localhost";
$WIN_TEMPFILE = "c:/temp/formmail.$$";
$mailprog = 'c:/windows/system32/blat.exe'; #No way is this going in CGI-BIN!!
$recipient = 'mike@***.co.uk';
$sender='mike@***.co.uk';
$email='mike@***.co.uk';
$subject="Test\n\n";
open(MAIL,">$WIN_TEMPFILE");
local($BLAT_ARGS);
print MAIL "Website Quotation Request\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 -ss -serverSMTP localhost -penguin"; # Found this mod in Aprelium Forum.
$BLAT_ARGS .= "-f $email";
$BLAT_ARGS .= "-s \"$subject\" ";
$BLAT_ARGS .= "-q";
system "$mailprog $BLAT_ARGS";
unlink $WIN_TEMPFILE;
print "Location:$fileout\n\n";
exit;
|
The above generates the following output..
Win32 console utility to send mail via SMTP or post to usenet via NNTP by P.Mendes,M.Neal,G.Vollant,T.Charron,T.Musson,H.Pesonen,A.Donchey,C.Hyde http://www.blat.net syntax: Blat -to [optional switches (see below)] Blat -SaveSettings -f -server [-port ] [-try ] [-profile ] [-u ] [-pwd ] or Blat -install [[[]]] [-q] Blat -profile [-delete | ""] [profile1] [profileN] [-q] Blat -h Location:
No email is sent as it does not appear in QK's log..
I also tried without the mods to the BLAT_ARGS and it generates the same response.
The temp file is not deleted (unlink) so I guess the problem is in the syntax of the blat command line ??
Mike _________________ Mike Montgomery |
|
Back to top |
|
|
mikem22 -
Joined: 26 Oct 2007 Posts: 13
|
Posted: Sat Oct 27, 2007 11:26 am Post subject: |
|
|
Hi,
I have it working;
My syntax left out the spaces between e.g.
... -t $email"; should have been
... -t $email ";
What I did was put the arguments into 1 line of code..
Quote: |
$BLAT_ARGS = "$WIN_TEMPFILE -t $recipient -f $email -s \"$subject\" ";
|
Mike _________________ Mike Montgomery |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Tue Nov 13, 2007 3:12 pm Post subject: |
|
|
mikem22,
So it was this little missing space that caused all the trouble. :-) Glad to know that the problem is solved now. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
|