<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Dear Friends</p>
<p>Sorry for the beginner question!<br>
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):</p>
<p>
<blockquote type="cite">while ( my $userdata =
$users_data->next ) {<br>
<br>
$c->stash->{email} = {<br>
to =>
$userdata->felhasznalo->emailaddr,<br>
from => '....',<br>
subject => '....',<br>
body => 'Body Body Body',<br>
};<br>
<br>
$c->forward( $c->view('Email') );<br>
<br>
if ( scalar( @{ $c->error } ) ) {<br>
#$c->error(0); # Reset the error condition if you
need to<br>
$c->response->body('Oh noes!');<br>
} else {<br>
$c->response->body('Email sent A-OK! (At least as
far as we can tell)');<br>
}<br>
}</blockquote>
Everything is working well, until changing an address to
unexistent or bad mail address intentionally.<br>
At that point the $c->error checking not working, the while
loop breaks with the following response:</p>
<p>
<blockquote type="cite">
<pre role="list"><code class="wrappedText focusRow" role="listitem">4.1.2 <a class="moz-txt-link-rfc2396E" href="mailto:sabidfgc@freeemail.hu"><sabidfgc@freeemail.hu></a>: Recipient address rejected: Domain not found
</code><code class="wrappedText focusRow" role="listitem">
</code><code class="wrappedText focusRow" role="listitem">
</code><code class="wrappedText focusRow" role="listitem">Trace begun at /home/csabi/perl5/lib/perl5/Email/Sender/Transport/SMTPS.pm line 122</code></pre>
</blockquote>
...etc...<br>
</p>
<p>At the doc below:</p>
<p><a class="moz-txt-link-freetext" href="http://search.cpan.org/~rjbs/Email-Sender-1.300030/lib/Email/Sender/Manual/QuickStart.pm">http://search.cpan.org/~rjbs/Email-Sender-1.300030/lib/Email/Sender/Manual/QuickStart.pm</a></p>
<p>there is a section called: "in case of error"<br>
in that:<br>
<blockquote type="cite"><span style="color: rgb(0, 0, 0);
font-family: arial, sans-serif; font-size: medium; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing: normal; orphans:
2; text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255,
255, 255); display: inline !important; float: none;">If you'd
rather not have to catch exceptions for failure to send mail,
you can use the<span class="Apple-converted-space"> </span></span><code
style="color: rgb(0, 0, 0); font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255,
255, 255);">try_to_send</code><span style="color: rgb(0, 0,
0); font-family: arial, sans-serif; font-size: medium;
font-style: normal; font-variant-ligatures: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; orphans: 2; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); display: inline
!important; float: none;"><span class="Apple-converted-space"> </span>method,
which can be imported as<span class="Apple-converted-space"> </span></span><code
style="color: rgb(0, 0, 0); font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255,
255, 255);">try_to_sendmail</code><span style="color: rgb(0,
0, 0); font-family: arial, sans-serif; font-size: medium;
font-style: normal; font-variant-ligatures: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; orphans: 2; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); display: inline
!important; float: none;">. This method will return just false
on failure to send mail.</span></blockquote>
I'd like to try that way, but i do not know, how to implement in
Catalyst.<br>
If i use: <br>
</p>
<p>$c->forward( $c->view('Email') ) || return;<br>
the while loop stops after the first run.</p>
<p>Thank You in advance!<br>
Csabi<br>
</p>
<p><br>
</p>
</body>
</html>