Click to See Complete Forum and Search --> : send mail using IMAIL server
inderpal
08-08-2006, 09:18 AM
Hi,
Does anybody have used PERL CGI script to send mails using IMAIL server on windows? I would appreciate any help in this regard.
Thanks in advance!!
Best Regards,
Inderpal Singh
PineSolPirate
08-08-2006, 11:34 AM
I think IMAIL is just a pop3, smtp, imap server.
You should be able to use the perl modules for each of those to handle it.
For sending that should be Email::Send::SMTP (http://search.cpan.org/~rjbs/Email-Send-2.171/lib/Email/Send/SMTP.pm)
inderpal
08-08-2006, 12:43 PM
Hi,
You are right. I have a code
sub real_send_mail {
$mailer = 'c:\sendmail\sendmail.exe';
$flags = "-t";
$mail_program = "$mailer $flags ";
local($fromuser, $fromsmtp, $touser, $tosmtp, $subject, $messagebody) = @_;
local($old_path) = $ENV{"PATH"};
open (MAIL, "|$mail_program") ||
&web_error("Could Not Open Mail Program");
$ENV{"PATH"} = $old_path;
print MAIL "To: $touser\n";
print MAIL "From: $fromuser\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$messagebody\n";
close (MAIL);
} #end of real_send_mail
The above code sends an email using IndigoMail server. I am looking something similar for IMail Server.
Best Regards,
Inderpal Singh
PineSolPirate
08-08-2006, 02:58 PM
I did a little reading, and I think it's just a system service.
Try getting Net::SMTP from your perl distributor (CPAN?)
Then this guy
use Net::SMTP;
$smtp = Net::SMTP->new('localhost'); # connect to an SMTP server
$smtp->mail( 'user@here.com' ); # use the sender's address here
$smtp->to('user@there.com'); # recipient's address
$smtp->data(); # Start the mail
# Send the header.
$smtp->datasend("To: user@there.com\n");
$smtp->datasend("From: user@here.com\n");
$smtp->datasend("\n");
# Send the body.
$smtp->datasend("Hello, World!\n");
$smtp->dataend(); # Finish sending the mail
$smtp->quit; # Close the SMTP connection
If your web server is on the same machine that might work, otherwise make sure you change localhost to whatever the machine is thats running IMail.
Sorry I can't help more, I'm just kinda guessing at how IMail works :)
inderpal
08-08-2006, 03:17 PM
Hi,
I tried using that but it's not working. Thanks for all your help.
Best Regards,
Inderpal Singh
PineSolPirate
08-08-2006, 03:51 PM
Found something!
http://support.ipswitch.com/kb/IM-19980119-DD10.htm
Try using that command line stuff and the system() call.
inderpal
08-08-2006, 04:08 PM
Thanks a lot! That's exactly what I need.
Best Regards,
Inderpal Singh