Solved

Sending Email - Problem

Posted on 2003-11-14
6
525 Views
Last Modified: 2008-02-01
Hi All,
I am getting a problem while sending the Email.Here is the code for that.
********************************************************
use MIME::Entity;

sub emailRpt
{
      my ($fileToEmail, $locationOfFile) = @_;
      my $toEmailList = getConfigString("AVD_ADDENDUM_DATE_REPORT", "toEmailList");
      my $fromEmailAddress = getConfigString("AVD_ADDENDUM_DATE_REPORT", "fromEmailAddress");
      my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime( );
      $mon++;
        $year+=1900;
       
        $mon = sprintf("%02d", $mon);
        $mday = sprintf("%02d", $mday);
        my $subject = "$reportName  ${mon}\/${mday}\/${year}";
            my $body = "Report Attached";

      print LOG "Email is been sent to $toEmailList with subject $subject and file attached is -$fileToEmail \n";      

      timeTest::emailAttachFile("$toEmailList",
                  "$fromEmailAddress",
                  "$subject",
                  "$body",
                  "$fileToEmail",
                  "$locationOfFile");
}
**********************************************************

Now i am getting this error while trying to send this email.

**********************************************************
This error was when i did not do anything on the system.
***********************************************************
egypt IT_test_nbo_27_fst_prov> perl v
Can't locate MIME/Entity in @INC (@INC contains: /usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 .) at /usr/local/lib/perl5/site_perl/5.005/MIME/Entity.pm line 223. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.005/MIME/Entity.pm line 223. BEGIN failed--compilation aborted at v line 14.
****************************************************
After copying Entity.pm
****************************************************
egypt IT_test_nbo_27_fst_prov> perl v
Can't locate MIME/ToolUtils.pm in @INC (@INC contains: /usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 .) at /usr/local/lib/perl5/site_perl/5.005/MIME/Entity.pm line 223. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.005/MIME/Entity.pm line 223. BEGIN failed--compilation aborted at v line 14.
*********************************************
After copying ToolsUtils.pm
********************************************
egypt IT_test_nbo_27_fst_prov> perl v
Can't locate MIME/Head.pm in @INC (@INC contains: /usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 .) at /usr/local/lib/perl5/site_perl/5.005/MIME/Entity.pm line 224. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.005/MIME/Entity.pm line 224. BEGIN failed--compilation aborted at v line 14.
********************************************************
After copying everying under the MIME directory from scarlet Unix System  to egypt Unix System egypt . It is working fine on scarlet Unix System  but on egypt. scarlet and egypat are name of the Unix box. So do not get confused from that.
**********************************************************
IT_test_nbo_27_fst_prov> perl v Can't locate IO/Wrap.pm in @INC (@INC contains: /usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 .) at /usr/local/lib/perl5/site_perl/5.005/MIME/Head.pm line 111. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.005/MIME/Head.pm line 111. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.005/MIME/Entity.pm line 224. BEGIN failed--compilation aborted at v line 14. egypt IT_test_nbo_27_fst_prov>
*****************************************
Now it seems that egypat Unix box is not having that Entity.pm module which creating problem.I do not have privilages to change that and we are using PERL 5.005003
Now i am having a question here whether we can modify this code in some way so that it can work.

Thanks in advance.

Regards,
Aaku
0
Comment
Question by:akku_batra
  • 2
  • 2
6 Comments
 
LVL 20

Accepted Solution

by:
jmcg earned 25 total points
ID: 9753063
The short answer is that you will get the greatest satisfaction if the Perl environments on the various servers can be brought up to the same level -- same version of Perl, same suite of modules installed.

If that's not possible, you can get fairly close using the approach that it seems you are already using: installing the missing modules into whatever filesystem space you are allowed to use on the server. Perl's

use lib qw(/path/to/library);

statement can be added at the top of your scripts to enable use of these additional modules.

In the Perl FAQ, there's a question "how do I keep my own module/library directory" that addresses this general topic, but it does not quite tell you what to do when you are copying files over to a server where you do not have full login privileges. Because you can only copy files, you may find you can't install some modules this way because they require compilation of some components on the target machine. That can effectively prevent you from using such a module.

0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 25 total points
ID: 9767577
As jmcq says, you don't install modules by just blindly copying files.  You use the standard way of installing, ie:

perl Makefile.PL
make
make test
make install

Why are you using  MIME::Entity to send mail?  Most people use MIME::Lite as it is very easy to use (and install)
0
 
LVL 5

Expert Comment

by:BlackDiamond
ID: 9767579
The perl CPAN module will help you install those modules correcly (it will also take care of the dependency issues that you are encountering).  Problem is that you will likely need root to run it successfully. The command to run is:

perl -MCPAN -e 'install MIME'
0
 
LVL 48

Expert Comment

by:Tintin
ID: 9767607
Hence the reason MIME::Lite is better to use as it consists of a single file.
0
 
LVL 20

Expert Comment

by:jmcg
ID: 10093394
Nothing has happened on this question in more than 7 weeks. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
split points between jmcg and Tintin.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now