in reply to Email program with attachments

From the error messages I would think the error is not in the code you posted, but instead on the module Mail::Sender.

Update 1: - next paragraph proven wrong, and I decided I don't like Mail::Sender :)

Try moving the new Mail::Sender and $sender->Close outside the loop and see if that fixes it, or look inside Mail::Sender for clues.

Update 2: - message "Mail was sent OK." is premature. (and let me in the wrong path)

On a side note, you line reading could be done with one regex instead of two and a split:
my ($email, $file) = $_ =~ /^'(.*)','(.*)'$/;
or something to that effect

tstock
++$|; # I call this the plunger. it cleans the pipes

Replies are listed 'Best First'.
Re: Re: Email program with attachments
by $code or die (Deacon) on Oct 09, 2001 at 03:06 UTC
    No. $sender is lexically scoped and has no meaning outside the loop.

    The error is with the code. If you look at the docs, the Close() method sends the mail, if you move $sender->Close() outside the loop, the best you can hope for is only one email being sent - the last one.

    I can understand why you think that the problem is with the module's code - the error messages look that way - because the module uses warn() and not carp() in those lines.

    Simon Flack ($code or die)
    $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
    =~y'_"' ';eval"die";print $_,lc substr$@,0,3;