> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of $Bill Luebkert
> Sent: Thursday, October 07, 2004 9:49 PM
> To: Uma Chandrsekaran
> Cc: [EMAIL PROTECTED]
> Subject: Re: Need help on usage of "sendmail" in Windows 2000 Server
> 
> 
> Uma Chandrsekaran wrote:
> 
> > Hi
> > 
> > I tried this script for sending mail in Windows 2000 Server, but it 
> > failed.
> > 
> > use Mail::Sendmail;
> > 
> > %mail = ( To      => '[EMAIL PROTECTED]',
> >           From    => '[EMAIL PROTECTED]',
> >           Message => "This is a very short message"
> >         );
> > sendmail(%mail) or warn $Mail::Sendmail::error;
> > 
> > Look like these set of commands are not getting executed as I not 
> > getting any mail & it also doesnot give me any error message.
> > 
> > Your input on this would be highly appreciated.
> 
> I would use Net::SMTP for simple messages or MIME::Lite 
> (which also uses Net::SMTP) for more complicated email needs 
> (attachments etc).


You can certainly use the Net::SMTP or MIME::Lite as $Bill has 
recommended above, but if you want to stick with Mail::Sendmail you'll
need to do a couple of things.

First, make sure you use a backslash before the "@" in the email
addresses.
Second, you need to specify your smtp Mail Server that will handle your 
request. And lastly, you should print the Mail::Sendmail::error when
things fail, in fact you can use Mail::Sendmail::log to get the result
of
your attempt.  Here's an example for you to play with.

        use strict;
        use Mail::Sendmail;

      my $msg                 = "This is a very short message\n";
      my $priority              = "High";
      my $Subject             = "Mail::Sendmail Example";
      my $To                  = "Some User
\<[EMAIL PROTECTED]>,";
      my $From                = "You \<[EMAIL PROTECTED]>";
      my $MailServer            = "smtp-mailserver.someplace.com";
      my %mail;

      unshift @{$Mail::Sendmail::mailcfg{'smtp'}} , $MailServer;
      %mail = ('To'           => $To,
               'From'          => $From,
               'Subject'       => $Subject,
               'Message'       => $msg,
               'Importance'    => $priority,
               'X-Mailer'      => 'Mail::Sendmail version
$Mail::Sendmail::VERSION',
               );
      sendmail(%mail) or die $Mail::Sendmail::error;
      print "SendMail Log says:\n", $Mail::Sendmail::log;
      print "\n";


Good Luck.

Carter.


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to