Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error sending email with MIME::Lite module

Status
Not open for further replies.

breezesunshine

Technical User
Jun 18, 2005
5
US
With the following code, I keep getting this error "'sendmail' is not recognized as an internal or external command, operable program or batch file."

I am using ActivePerl on Windows. MIME::Lite has been installed.

Can someone please shed some light on the possible causes?

Thanks very much!

---------

use MIME::Lite;

### Create the multipart "container":
$msg = MIME::Lite->new(
From =>'XX@yahoo.com',
To =>'XX@hotmail.com',
Subject =>'A message with 2 parts...',
Type =>'multipart/mixed'
);

### Add the text message part:
### (Note that "attach" has same arguments as "new"):
$msg->attach(Type =>'TEXT',
Data =>"Here's the JPG file you wanted"
);

### Add the image part:
$msg->attach(Type =>'image/jpg',
Path =>'d:/test.jpg',
Filename =>'test.jpg',
Disposition => 'attachment'
);


### Format as a string:
$str = $msg->as_string;

### Write just the header:
$msg->print_header(\*STDOUT);

### Send in the "best" way (the default is to use "sendmail"):
$msg->send;

-------------------
 
This is from the MIME::Lite documentation
MIME::Lite->send()

When used as a classmethod, this can be used to specify a different default mechanism for sending message. The initial default is:

MIME::Lite->send("sendmail", "/usr/lib/sendmail -t -oi -oem");

However, you should consider the similar but smarter and taint-safe variant:

MIME::Lite->send("sendmail");

Or, for non-Unix users:

MIME::Lite->send("smtp");
Did you touch the documentation at all?
And if you are wondering what is this sendmail, is a *nix software. Not windows, which you are working with.


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Thanks so much for the reply! :)

Ok, So I changed the code to include:

"use NET::SMTP;";

Then changed the last line of code to:

$msg->send("SMTP");

Running the script again get me this error:

"Can't locate object method "send_by_SMTP" via package "MIME::Lite" at C:/Perl/li
b/MIME/Lite.pm line 2451."

Sorry for the question again. I am new to Perl. :)
Thanks!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top