My web shosting ISP (featureprice.com) has applied 'pop-before-smtp' rule on its SMTP
server so every time anyone want to send mail via their smtp server, the user has to
login to the POP3 account first (to identity they are valid users). They do this to
prevent their smtp server being abused as a spam server. I can understand how this 
works
if I am using a PC email client to send/receive emails (you just check mail before you
send email). However, i am trying to send an email from inside a cgi perl script on the
server using the unix 'sendmail' command. I got "553 sorry, that domain isn't in my 
list
of allowed rcpthosts" message after doing this. 

Then I added a few lines of code (POP3 login) hoping this will let the server know 
that I
am a valid user (see attached code), but it still doesn't work (still got 553). I 
wonder
if anyone has experience with this or how to do thjis in perl code. Thanks a lot.

#!/usr/bin/perl

require './myown.cgi';
&Standard_Function;
use Mail::Sendmail;
use Mail::POP3Client;

##### to deal with pop-before-smtp, 
##### first use pop3 to log in to the server
$pop = new Mail::POP3Client( HOST     => "my.pop3.server",  ## pop server name
                             USER     => "myusername",     ## send ID
                             PASSWORD => "mypass",      ## send password
                             AUTH_MODE => 'PASS',    ## send password by PASS, not 
APOP  
                              DEBUG    =>0);    ## don't show debug message 

##### check to see if there is any mail
##### just checking, don't do anything
  for( $i = 1; $i <= $pop->Count(); $i++ ) {
    foreach( $pop->Head() ) {
      # do nothing
    }
 }
##### close the connection after successful pop3 login
$pop->Close();

##### after successful login,
##### send email from the Mail::Sendmail module
%mail=(To      => "myemail\@yahoo.com",
       From    => "$in{'email'}",
       Subject => "$in{'subject'}",
       Message => "This message is from $in{'email'}\n$in{'feedback'}");

if (sendmail(%mail)) {
       &Print_Page("Message Sent","Your message has been sent to the webmaster. We will
resppond to you as soon as possible, thank you.");
     }
else {
       &Print_Page("Message Not Sent","Your message has not been sent because --
".$Mail::Sendmail::error. ". Please contact <a
href=\"mailto:$saadminemail\";>webmaster</a>, thank you.");
     }

exit; 
 

=====
Shao-Ju Chao (Bruce)
Do you Survey!?
Go to http://www.surveyanywhere.com and create your own survey.


__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to