MIME::Lite

Chris Jack chris_jack at msn.com
Mon Feb 1 17:57:36 GMT 2010


 
A perl question!
 
This is really just out of curiousity as I know the solution. We have a section of code that has been working fine using MIME::Lite that reads as follows:

  $msg = MIME::Lite->new(
                         From    =>SMTP_FROM_ADDRESS,
                         To      =>$email_list,
                         Subject =>$subject,
                         Type    =>'TEXT',
                         Data    =>$message_lines
                        );
  if($file_name)
  {
    my($name,$path,$suffix) = fileparse($file_name);
    ### Attach a part:
    $msg->attach(Type     =>'spreadsheet/xls',
                 Path =>$file_name,
                 Filename =>$name
                 );
  }
  ## Configure Mime to send via SMTP
  MIME::Lite->send('smtp', SMTP_HOST, Timeout=>60);
  if (! $msg->send())
  {
    print STDERR "Unable to send email:$!\n";
  }
 
 
Someone on the $email_list left the company, their email address became defunct and the above section of code failed. Taking them out of the distribution list made the code work again.
 
My question is: how/why did MIME::Lite know to fail?
 
My preconception is the email would be sent to an email queue that, at some point in the future, would attempt to get the email to the target address - at which point an email would be sent back reporting the failure. Immediate failure suggests the target address was either checked interactively or was cached somewhere as being defunct.
 
I am also wondering if it is even desirable for the above code to fail.
 
Thoughts/explanations?
 
Chris 		 	   		  
_________________________________________________________________
Got a cool Hotmail story? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/


More information about the london.pm mailing list