sub sendEmail { my($email, $c_first) = @_; $msg = MIME::Lite->new( To =>$email, From =>'marketing@taieriprint.co.nz', Subject =>$subject, Type =>'multipart/related' ); $msg->attach(Type => 'text/html', Data => qq{ Taieri Print Ltd
$Month $Year
Dear $c_first,
$message

We hope you have enjoyed recieving this message. However, if you'd rather not recieve future newsletters from us, then please click here to unsubscribe.
} ); $msg->attach(Type => 'image/gif', Id => 'tplogo.gif', Path => 'C:/mailbird/tplogo_new.gif', ); if ($query->param('attach')) { $msg->attach(Type => 'application/pdf', Path => $attachment, Filename => $filename); } $msg->send('smtp', 'smtp.taieriprint.co.nz') or warn print "Unable to send email: $_"; return; }