in reply to Re^2: mailer test
in thread mailer test
#!/usr/bin/perl # use MIME::Lite package use MIME::Lite; # set up email $to = "toemail\@gmail.com"; $from = "fromemail\@inbox.com"; $subject = "Email Sent via Perl"; $message = "This email was sent using Perl."; $file = "sample.txt"; # send email email($to, $from, $subject, $message, $file); # email function sub email { # get incoming parameters local ($to, $from, $subject, $message, $file) = @_; # create a new message $msg = MIME::Lite->new( From => $from, To => $to, Subject => $subject, Data => $message ); # add the attachment $msg->attach( Type => "text/plain", Path => $file, Filename => $file, Disposition => "attachment" ); # send the email MIME::Lite->send('smtp', 'smtp.yourisp.net', Timeout => 60); $msg->send(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: mailer test
by Anonymous Monk on Jul 07, 2009 at 06:34 UTC |