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 bkrike 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
Hi:

I apologize if this is a stupid question. I am new to Perl. Thanks in advance for your help!

I can't figure out why I keep getting this eror when running the code below:

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

The MITE::Lite module is installed successfully (I use PPM and ActivePerl on windows).

Here is the code:
--------------------------------
use MIME::Lite;
use NET::SMTP;

### Create the multipart "container":
$msg = MIME::Lite->new(
From =>'breezesunshine@yahoo.com',
To =>'lan_bo@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 GIF 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 the message;
$msg->send("SMTP");
 
Looks like the module might not be installed successfully. Try removing it, and reinstalling it

--Paul

cigless ...
 
Here is what I got when installing the MIME::Lite module. It seems that the module is installed successfully(see below):
--------------------------------------

ppm> install MIME::Lite
Searching for 'MIME::Lite' returned multiple results. Using 'search' instead...
Searching in Active Repositories
1. MIME-Lite [3.01] low-calorie MIME generator
2. MIME-Lite-HTML [1.21] Provide routine to transform a HTML page in a~
3. MIME-Lite-TT-Japane~ [0.02] MIME::Lite::TT with Japanese character code
ppm> install 1
Package 1:
====================
Install 'MIME-Lite' version 3.01 in ActivePerl 5.8.7.813.
====================
Downloaded 57712 bytes.
Extracting 7/7: blib/arch/auto/MIME/Lite/.exists
Installing C:\Perl\html\site\lib\MIME\changes.html
Installing C:\Perl\html\site\lib\MIME\Lite.html
Installing C:\Perl\site\lib\MIME\changes.pod
Installing C:\Perl\site\lib\MIME\Lite.pm
Successfully installed MIME-Lite version 3.01 in ActivePerl 5.8.7.813.

------------------

So I really do not understand why I got the error "Can't locate object method "send_by_SMTP" via Package "MIME::Lite" at C:/Perl/li
b/MIME/Lite.pm line 2451."

Thanks again for any help!
 
this is just a stab in the dark as I don't use Mime::Lite to send emails i use Net:SMTP, but from what I see it might be a case sensative problem i.e. send_by_smtp

as i have seen it shown on the net in ALL lower case, and as perl is case sensative, it might be the problems.

Regards,
1DMF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top