Forum Moderators: coopster & phranque

Message Too Old, No Replies

Windows IIS, Perl, and Emailing...

anything better than SMTP

         

Jay_R

2:01 pm on Jul 21, 2004 (gmt 0)

10+ Year Member



Hiya, I have to use this script to send off some info in an email while running on a windows server. Using sendmail on *nix is easy and fast. However, I haven't found anything on the window's IIS server that is comparable unless you buy third party software like Indigo's sendmail.

I've tried using Mail::Mailer's SMTP capability, but unfortunatly it's too slow and the email also never seems to turn up, and I can't seem to pick up an exception or error anywhere using eval and or.

I'm just wondering if anyone has any idea's. I do prefer not to talk to an SMTP server directly, for I've been brought up to beleive that's not a hot idea. Unfortunately, like I said, I haven't been able to find another way... Any help, advice, or direction would be appreciated.

Thanks,
-Jay

TheWhippinpost

2:57 pm on Jul 21, 2004 (gmt 0)

10+ Year Member



I, and my host have recently been havin a nightmare with sommat that may be the root of your prob... (unfortunately, I, and my host will be departin company by mutual consent 'cos we couldn't suss it out... or they couldn't!)

It could be that your winbox needs authentication, and it's possibly this at the root of it all - After lookin hard and wide I found the "best" advice seemed to be to use the, NET::SMTP

EG:


use Net::SMTP;
use Net::Config;

$user = "you\@yourdomain";
$pass = "whatever";
$smtp = Net::SMTP->new("$mail_server_hostname", Debug => 1) or die "Could not create object"; # connect to an SMTP server
$smtp->auth( "$user","$pass" );
$smtp->mail( "mail\@somedomain" ); # use the sender's address here
$smtp->to("you\@yourdomain"); # recipient's address

$smtp->data(); # Start the mail

# Send the header.

$smtp->datasend("To: mail\@yourdomain\n");
$smtp->datasend("From: $fromemail\n");
$smtp->datasend("Reply-to: you\@yourdomain\n");
$smtp->datasend("\n");

# Send the body.
$smtp->datasend("Hello, World!\n");
$smtp->dataend(); # Finish sending the mail
$smtp->quit; # Close the SMTP connection
}

NOTE: the inclusion of "$smtp->auth( "$user","$pass" );"

Now, the problem I had, when I setup the debug, it never found AUTHEN::SASL module. So I had the host install it but the problem never went away (despiute several install attempts).

I put it down eventually to the host (who apparently don't have many clients use perl as I do) didn't have the skillset to get it right.

Anyway, dunno if that helps but its an area to at least strike off the list of possible causes.

Good luck, let us know the solution if you find one.

Jay_R

4:50 pm on Jul 21, 2004 (gmt 0)

10+ Year Member



I use ActivePerl and test the scripts locally on my laptop, so I'm not sure if that causes a problem. The server I use is the same server as my email client uses, so I'm wagering it shouldn't need authentication since my client doesn't.

Anyway, I'm not familiar with the pros and cons of MAUs (Mail & Mailx) and MTAs (SendMail) or even how they work, but it's my understanding that they're a little more reliable than using your script to talk to the SMTP server. I'm also not up on the inner workings of the NET and Mailer modules, and if they address these issues.

The script i'm using generates a dynamic page, so I don't want to tolerate the lag I’m getting. The sendmail pipe was quick and troubless, so I was wondering if anyone knew a comparable open source (free) solution for windows. Of course the (‘windows’!= ‘open source’) statement is usually true, so maybe not.

Unfortunately, the host isn’t up to me, so I gotta figure something out or swallow my pride and get the indigo software, which, by the way, worked great.

One thing I was wondering about was the windows PHP alternative and how it works. Maybe it’s time to learn that.

Hopefully if we let this topic distill in this experience rich forum, we’ll get some feedback. Thanks for the help 'TheWhippinpost' and sorry about your host.

-Jay_r

TheWhippinpost

6:25 pm on Jul 21, 2004 (gmt 0)

10+ Year Member



It's your ISP, or site server on the net that is needin authentication, unless you're usin your own mail server on the lap that is.

The fact you mention a long time-lag points further to the same problem I experienced.