Sending an email via perl script -
Sending an email via perl script -
i next course of study of perl , have received task send myself email perl@perlrocks using mail::sendmail module.
though have read documentation, still don't understand how it. example, utilize gmail normal email, should configure gmail smpt protocol in script? please give me hint on how start?
it depends on environment. if you're running script on linux server, create sure sendmail
utility installed (most distributions have pre-installed). if you're on non-linux machine, install mailserver on or utilize external smtp server.
although specific mail service module does not back upwards smtp authentication, external smtp servers (like google/gmail) require. if have mailserver allow smtp connections machine perl script runs on, can simple as:
use mail::sendmail qw(sendmail %mailcfg); %mail = ( => 'you@example.com', => 'me@example.com', message => "hello world!" ); $mailcfg{smtp} = [qw(smtp.example.com)]; sendmail(%mail) or die $mail::sendmail::error;
that set smtp.example.com
e-mail server. (or can skip entire line if do have localhost mailserver, default).
perl email module
Comments
Post a Comment