On Fri, 26 Nov 2004, vishwas bhakit wrote: > how to send mail through perl script
One way to send mail is with the Mail::Send CPAN module. Quoting from `perldoc Mail::Send`: require Mail::Send; $msg = new Mail::Send; $msg = new Mail::Send Subject=>'example subject', To=>'timbo'; $msg->to('[EMAIL PROTECTED]'); $msg->subject('example subject'); $msg->cc('[EMAIL PROTECTED]'); $msg->bcc('[EMAIL PROTECTED]'); $msg->set($header, @values); $msg->add($header, @values); $msg->delete($header); # Launch mailer and set headers. The filehandle returned # by open() is an instance of the Mail::Mailer class. # Arguments to the open() method are passed to the Mail::Mailer # constructor. $fh = $msg->open; # some default mailer # $fh = $msg->open('sendmail'); # explicit print $fh "Body of message"; $fh->close; # complete the message and send it A simpler way might be the Email::Simple module. Quoting its perldoc: my $mail = Email::Simple->new($text); my $from_header = $mail->header("From"); my @received = $mail->header("Received"); $mail->header_set("From", 'Simon Cozens <[EMAIL PROTECTED]>'); my $old_body = $mail->body; $mail->body_set("Hello world\nSimon"); print $mail->as_string; # AND THAT'S ALL. Info on these two modules can be read here: <http://search.cpan.org/~markov/MailTools-1.65/Mail/Mailer.pm> <http://search.cpan.org/~cwest/Email-Simple-1.92/Simple.pm> There are many more modules like this on CPAN. Please familiarize yourself with searching for them and installing them with the CPAN command line tool, like so: $ sudo perl -MCPAN -e 'install Mail::Mailer' $ sudo perl -MCPAN -e 'install Email::Simple' or the interactive version of the CPAN shell, as $ sudo perl -MCPAN -e shell cpan> install Mail::Mailer Email::Simple Please let the list know if you have specific questions. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>