Dear Friends

Sorry for the beginner question!
I experiment with Catalyst::View::Email and i try to send mail to multiple addresses in a while loop (from a database table, containing email addresses: simply one row - one address):

while ( my $userdata = $users_data->next ) {

    $c->stash->{email} = {
        to          => $userdata->felhasznalo->emailaddr,
        from        => '....',
        subject     => '....',
        body        => 'Body Body Body',

    $c->forward( $c->view('Email') );

    if ( scalar( @{ $c->error } ) ) {
        #$c->error(0); # Reset the error condition if you need to
        $c->response->body('Oh noes!');
    } else {
$c->response->body('Email sent A-OK! (At least as far as we can tell)');
Everything is working well, until changing an address to unexistent or bad mail address intentionally. At that point the $c->error checking not working, the while loop breaks with the following response:

|4.1.2 <>: Recipient address rejected: Domain not found ||||||Trace begun at /home/csabi/perl5/lib/perl5/Email/Sender/Transport/ line 122|

At the doc below:

there is a section called: "in case of error"
in that:

If you'd rather not have to catch exceptions for failure to send mail, you can use the|try_to_send|method, which can be imported as|try_to_sendmail|. This method will return just false on failure to send mail.
I'd like to try that way, but i do not know, how to implement in Catalyst.
If i use:

$c->forward( $c->view('Email') ) || return;
the while loop stops after the first run.

Thank You in advance!

Searchable archive:
Dev site:

Reply via email to