Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

forms multiple action

edited February 2013 in Apps

I would like multiple action on custom form; is it possible?

I set "Email results to" and also "Email the user" fields but only the first seems to work.

Comments

  • It should handle all of the actions, so I wonder if there is a bug. Can you try each action separately and ensure they work on their own? If so, then one may be preventing the others from running. If not, then one of the actions may not be working correctly.

  • I should also mention that the order of form handling goes like this:

    1. Save results to the database
    2. Trigger any hooks
    3. Handle each action (email, cc recipient, and redirect)
    4. Reply to the user (if not redirected)

    So an error in a hook could also potentially prevent it from hitting the actions. Just something to be aware of while working on your custom hook handler :)

  • edited February 2013

    I'm realizing that this could be a smtp related problem.

    Please wait before looking for bugs.

    Sorry to steal your time.

  • I have tried in various ways also swapping email addresses and it seems that the second recipient (Email the user) does not receive the message if and only if there is even the first (Email results to).

  • Is really strange sometimes works and sometimes does not work. Maybe I'm tired now.

  • I wonder if the Mailer settings from the first call to send() are affecting the second call. I'll test that out on its own and hopefully narrow down the possibilities.

  • Problem solved!

    For some reason the server relay for some domains (those on which I had problems).

    Thanks for your time and sorry again.

  • Glad to hear it's solved, and it's no trouble at all :)

  • edited March 2013

    There are some issue in Mailer.php - Zend_Mailer can throw an exception when there are any issue with SMTP.

    There are patch from my elefant-derived project (sorry, broken formatting):

    Index: Mailer.php

    --- Mailer.php (revision 69) +++ Mailer.php (revision 70) @@ -236,7 +236,11 @@ } if ($send) { - return $mailer->send (); + try { + return $mailer->send (); + } catch (Exception $e) { + return false; + } } return $mailer; }

  • I guess I should have made Mailer's docs clearer. Mailer doesn't catch the exception from Zend_Mail since it's just a small wrapper around that library. The send() method actually returns the Zend_Mail object on success, but Zend_Mail does throw an exception on failure that you're expected to catch.

Sign In or Register to comment.