$mail_method = "1"; $mail_program = "/usr/sbin/sendmail"; $email_from = 'test@domain.com'; $email_to = 'neil@domain.com'; $email_subject = 'foo'; $email_text = 'bar'; $msg = MIME::Lite->new( From =>'$email_from', To =>'$email_to', Subject =>'$email_subject', Type =>'multipart/mixed', Data =>'$email_text' ); #if ($email_attach) { #$msg->attach( # Type =>'$email_attach_type', # Path =>'$email_attach_path', # Filename =>'$email_attach_file', # Disposition => 'attachment' #); #} if ($mail_method eq "1") { MIME::Lite->send("sendmail", "$mail_program"); } elsif ($mail_method eq "2") { MIME::Lite->send('smtp', "$smtp_address", Timeout=>$smtp_timeout); } $msg->send || die "sendmail failed";