#!/usr/bin/perl ... this is your code, to it you add the following use Mail::Mailer 'smtp', Server => 'foo.example.com';