Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^2: Email::Mime 1 email + multiple attachments

by kazak (Beadle)
on May 20, 2012 at 18:08 UTC ( #971508=note: print w/ replies, xml ) Need Help??

in reply to Re: Email::Mime 1 email + multiple attachments
in thread [Resolved]Email::Mime 1 email + multiple attachments

I've done so before asking, sorry I forgot to mention about this. If I'm trying to access @parts not in "foreach" @parts are empty. Like yesterday:

./ Last execution date, not found for: Weekly summary DATE:2012-05-19 TODAY:2012-05-19 NEXT:2012-05-19 report: credentials last executed: 2012-05-19 next scheduled: 2012-05-19 FILENAME:Servers.7z FILENAME:weekly_sites.7z Net::SMTP>>> Net::SMTP(2.31) Net::SMTP>>> Net::Cmd(2.29) Net::SMTP>>> Exporter(5.63) Net::SMTP>>> IO::Socket::INET(1.31) Net::SMTP>>> IO::Socket(1.31) Net::SMTP>>> IO::Handle(1.28) Net::SMTP=GLOB(0x15ff3b0)<<< 220 (mrbap4) Welcome to Zeus +ESMTP server Net::SMTP=GLOB(0x15ff3b0)>>> EHLO localhost.localdomain Net::SMTP=GLOB(0x15ff3b0)<<< Net::SMTP=GLOB(0x15ff3b0)<<< 250-STARTTLS Net::SMTP=GLOB(0x15ff3b0)<<< 250-AUTH LOGIN PLAIN Net::SMTP=GLOB(0x15ff3b0)<<< 250-AUTH=LOGIN PLAIN Net::SMTP=GLOB(0x15ff3b0)<<< 250-SIZE 120000000 Net::SMTP=GLOB(0x15ff3b0)<<< 250 HELP Net::SMTP=GLOB(0x15ff3b0)>>> AUTH LOGIN Net::SMTP=GLOB(0x15ff3b0)<<< 334 VXNlcm5hbWU6 Net::SMTP=GLOB(0x15ff3b0)>>> cmVwb3J0ZXJAZGlhbG9nLXdlYmRlc2lnbi5kZQ== Net::SMTP=GLOB(0x15ff3b0)<<< 334 UGFzc3dvcmQ6 Net::SMTP=GLOB(0x15ff3b0)>>> cmVwb3J0ZXJxYXo= Net::SMTP=GLOB(0x15ff3b0)<<< 235 Authentication successful Net::SMTP=GLOB(0x15ff3b0)>>> MAIL FROM:< > Net::SMTP=GLOB(0x15ff3b0)<<< 250 OK Net::SMTP=GLOB(0x15ff3b0)>>> RCPT TO:<> Net::SMTP=GLOB(0x15ff3b0)<<< 250 OK Net::SMTP=GLOB(0x15ff3b0)>>> DATA Net::SMTP=GLOB(0x15ff3b0)<<< 354 Enter mail, end with "." on a line by + itself Net::SMTP=GLOB(0x15ff3b0)>>> To: Net::SMTP=GLOB(0x15ff3b0)>>> From: Net::SMTP=GLOB(0x15ff3b0)>>> Subject: credentials Net::SMTP=GLOB(0x15ff3b0)>>> Date: Sat, 19 May 2012 19:26:23 +0200 Net::SMTP=GLOB(0x15ff3b0)>>> MIME-Version: 1.0 Net::SMTP=GLOB(0x15ff3b0)>>> Content-Disposition: inline Net::SMTP=GLOB(0x15ff3b0)>>> Content-Type: text/plain; charset="us-asc +ii" Net::SMTP=GLOB(0x15ff3b0)>>> . Net::SMTP=GLOB(0x15ff3b0)<<< 250 Message 0LiUtY-1Rw1Ew1QTc-00crW0 acce +pted by Net::SMTP=GLOB(0x15ff3b0)>>> QUIT Net::SMTP=GLOB(0x15ff3b0)<<< 221 OK

Comment on Re^2: Email::Mime 1 email + multiple attachments
Download Code
Re^3: Email::Mime 1 email + multiple attachments
by Eliya (Vicar) on May 20, 2012 at 18:22 UTC
    If I'm trying to access @parts not in "foreach" @parts are empty.

    You don't show the updated code, but my guess would be that you still have my @parts = ... within the foreach loop (like in your OP), instead of declaring the @parts array outside of the loop (like in the code I outlined).

    If you declare it within the loop, it's lexically scoped to the loop, i.e. not accessible outside of it.  Also, you'd create a new array instance on every iteration, instead of accumulating stuff in it.

[Resolved] Re^3: Email::Mime 1 email + multiple attachments
by kazak (Beadle) on May 20, 2012 at 18:30 UTC
    Sorry Eliya, this was my bad. It's true that I tried to use "@parts" outside foreach, BUT I used "@parts =" instead of "push" and this was main problem. You were absolutely right when you wrote your reply to me. Thank you very much.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://971508]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2014-09-20 16:16 GMT
Find Nodes?
    Voting Booth?

    How do you remember the number of days in each month?

    Results (160 votes), past polls