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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question regarding MIME::Lite send method.

Status
Not open for further replies.

CHeighlund

Programmer
Jun 11, 2007
163
US
I've been working with a program in perl, mostly copied from another written by my predecessor, which is designed to automatically email a set of files to various employees for our main customer.

To now, the only real 'output' anyone running the program has seen was 'Emailing [address]', printed right before the call to the email subroutine. As these were intended to be automated, this has never been a problem before. My boss, however, ran the program manually earlier today, and wants some kind of proof that the message and related files have been sent.

What do I need to do in my code in order to catch the return value (assuming a true/false return; I may be incorrect here) from the MIME::Lite->send() command? Actual code involved is
Code:
       MIME::Lite->send('smtp', $mail_host, Timeout=>60);
       $msg->send;
where $msg is set as MIME::Lite->new.
 
maybe
my $output = $msg->send;
print "$output\n";


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
I'm not sure that worked out correctly;

A test run on a .txt file seemed to work acceptably, but the code itself was supposed to send out a .pdf file; I received the following error message when I attempted to run it:
Code:
1) DBRECAPY.PDF
DCD= Y
email to *******.**@*********.***
Sending email from *******@*******.com
to *******.**@*********.*** via mail.hiwaay.net

Attaching file DBRECAPY.PDF

Uncaught exception from user code:
        DBRECAPY.PDF: not readable
        MIME::Lite::verify_data('MIME::Lite=HASH(0xc65eb0)') called at /usr/lib/perl5/site_perl/5.8.3/MIME/Lite.pm line 1992
        MIME::Lite::verify_data('MIME::Lite=HASH(0xc575b0)') called at /usr/lib/perl5/site_perl/5.8.3/MIME/Lite.pm line 2450
        MIME::Lite::send('MIME::Lite=HASH(0xc575b0)') called at ./email-dbrecap_allloop line 210
        main::email_S('*******.**@*********.***','DBRECAPY.PDF') called at ./email-dbrecap_allloop line 85
Email addresses blotted out, other code left intact. Any suggestions as to what I might be doing wrong here?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top