foreach (@{$userinfo}) { $sendmail_info->{EmailAddress} = $_->{EmailAddress}; SendIt($sendmail_info); # Here is where I think we should say sleep 15; # (or other interval, 4 emails per # minute equals 240 e-mails per hour) } sub SendIt { my $info = shift @_; my $msg = MIME::Lite->new( 'From' =>'foo@foobar.com' 'To' => $info->{EmailAddress}, 'Subject' => $info->{EmailSubject}, 'Type' =>'multipart/mixed' ); $msg->attach(Type =>'TEXT', Data => $info->{EmailMessage} ); $msg->attach(Type =>$info->{MimeType}, Path => $info->{Attachment}, Filename => $info->{AttachmentName}, Disposition => 'attachment' ); $msg->send_by_sendmail('SetSender'=>1,'FromSender'=>'foo@foobar.com'); }