Results 1 to 2 of 2

Thread: Need help with this perlscript

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Posts
    67

    Post

    I need to send an E-mail from my web page and it's finished execpt for the send mail.
    I 've try to use CDONtS but it's not configured on the server and the admin doesn't want to set
    it (don't ask me why!). So i have found a perlscript for ASP that respond to mail send to
    your account. The prob is i don't know a bit of perl yet and i would really appreciate
    if someone could help me with it so it sends e-mail to a specific e-mail adress.

    Here is the PerlScript I found:


    Code:
    <%@language=perlscript%> 
     <% 
     use Net::POP3; 
     use Net::SMTP; 
    
              $srv = Net::POP3->new('mail.PerlScripters.com'); 
              $get = $srv->login('admin', 'password'); 
              $msg = $srv->list(); 
    
    
              foreach $m (keys %$msg) { 
               $read = $srv->top($m, 3); 
    
               for(@$read) { 
               if($_=~/From:/) { 
               local (@d) = split(/ /, $_); 
               @a[$m]=$d[1]; 
               } 
               } 
              } 
    
          $srv->quit(); 
    
    
    
              for($b=1; $b<=$#a; $b++) { 
              $smtp = Net::SMTP->new('mail.PerlScripters.com'); 
              $smtp->mail( '[email protected]' ); 
    
              my $c = ($a[$b]); 
              $smtp->to($c); 
              $smtp->data(); 
              $smtp->datasend("Subject: Automated Response\n"); 
              $smtp->datasend("To: $to\n"); 
              $smtp->datasend("From: autoresponder\@PerlScripters.com\n"); 
              $smtp->datasend("Your mail has been received"); 
              $smtp->dataend(); 
              undef $c; 
              $smtp->quit; 
              } 
     %>
    Thanks a lot !!!
    If possible please provide codes.
    Process by example is the best way to learn.

  2. #2
    Guest
    Code:
    <%@language=perlscript%> 
     <% 
     use Net::POP3; 
     use Net::SMTP; 
    
              $srv = Net::POP3->new('mail.PerlScripters.com'); 
              $get = $srv->login('admin', 'password'); 
              $msg = $srv->list(); 
    
    
              foreach $m (keys %$msg) { 
               $read = $srv->top($m, 3); 
    
               for(@$read) { 
               if($_=~/From:/) { 
               local (@d) = split(/ /, $_); 
               @a[$m]=$d[1]; 
               } 
               } 
              } 
    
          $srv->quit(); 
    
    
    
              for($b=1; $b<=$#a; $b++) { 
              $smtp = Net::SMTP->new('mail.PerlScripters.com'); 
              $smtp->mail( '[email protected]' ); #this part right here looks like its the email address being sent to.
    
              my $c = ($a[$b]); 
              $smtp->to($c); 
              $smtp->data(); 
              $smtp->datasend("Subject: Automated Response\n"); 
              $smtp->datasend("To: $to\n"); 
              $smtp->datasend("From: autoresponder\@PerlScripters.com\n"); 
              $smtp->datasend("Your mail has been received"); 
              $smtp->dataend(); 
              undef $c; 
              $smtp->quit; 
              } 
     %>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width