Forums

send results to more emailadresses

bien 27 Apr, 2007
Hi,

I want the results of my form to be sent to multiple emailadresses. So I looked it up here and seperated the adresses with a ',' as told in the faq.

It doesn't work I'm affraid. The first emailadress recieves the resaults, but the others don't. What did I do wrong?
Max_admin 27 Apr, 2007
If u wanna do this then under the configuration choose "my template" for "In which format to send the results email?", then choose custom at the form management for "email results?" and then put ur emails below with "," in between.

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ariadne 30 Aug, 2007
My problem is the maximum number of characters that I can enter .. i need more than 100 cause i'm doing a cyberaction to politicians.

Can i cut the restrition?
GreyHead 30 Aug, 2007
Hi ariadne,

If you want to lengthen the pre-set email address field then you'll need to hack the admin.chronocontact.html.php file. search for 'extraemail' and you'll find the input field code and can increase the 'maxlength' attribute. I don't know if there is any limit on how big you can make this.

If you really want to personalise your cyberaction emails - say to send personal 'Dear John' emails to each recipient - this is probably possible with a little more coding.

Bob
ariadne 30 Aug, 2007
Hello GreyHead

Thank's in advance for the reply.
I tried change the maxlength atribute, up to 5000, but i doesn't work. If I enter somenthing like 7 emails address the form is send without any problem, but if i enter all the politicians addresses (including my for test) i don't receive any message.

:(<br><br>Post edited by: ariadne, at: 2007/08/30 17:30
GreyHead 30 Aug, 2007
Hi ariadne,

There may be a limit on what the mailer will deal with then.

I posted a first version here that needed a code hack. This revised version is much better.

Here's where I'd go I think.

Put this in the OnSubmitcode - before e-mail field:
<?php
$address_array = array(politician.one@example.com; politician.two@example.com, . . . );
$recipient = array_merge($recipient, $address_array);
?>
This lets you edit the address array from the form manager and will add the address list to any that you already have from the form.

Bob

Edited to correct $recipient variable name<br><br>Post edited by: GreyHead, at: 2007/08/31 00:05
ariadne 31 Aug, 2007
Hi Bob,

Thank's again for the help!

The system don't let me save the changes with an empty Email adress field: "if you choose to email results then you must add: Email adress, Email subject, From Name e From Email".

Ariadne
GreyHead 31 Aug, 2007
Hi ariadne,

That's OK, just put either your e-mail address (or a null address like [email]user@example.com[/email]) in there, it will be added to the list to be sent.

Bob

PS the Joomla mailer does check each e-mail address and verify it has the correct structure, if any of them fail then the e-mail is not sent and (at present) there is no error message.
ariadne 31 Aug, 2007
:unsure: I think i didn't marge, only the e-mail enter in "Email Address(es):" is receiving the messages.
GreyHead 31 Aug, 2007
Hi ariadne,


Please ignore: My apologies, that should be $recipient (not $recipients) in the code I posted. I've edited my post, please try again with the amended version.

See Max's post later - I got this wrong.

Bob

Post edited by: GreyHead, at: 2007/08/31 00:06<br><br>Post edited by: GreyHead, at: 2007/08/31 00:11
Max_admin 31 Aug, 2007
Hi Ariadne,

Lets try this :

At a clean v2.3 RC1 installation, fill in the required fields for the form then add this code at your onSubmit before email box :


<?php
$rows[0]->extraemail = $rows[0]->extraemail.",politician_1@email.com,politician_2@email.com
,politician_3@email.com,politician_4@email.com";
?>


Please let us know!!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max_admin 31 Aug, 2007
Hi Bob,Ariadne,

The issue is that the $recipient variable is not yet defined by the onsubmit before email execution line at v2.3 RC1😉

Thank you!!

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 31 Aug, 2007
Hi Max,

Yes, just spotted that. Ariadne, apologies for misleading you.

Bob
Max_admin 31 Aug, 2007
No worries, I think it should be defined earlier to make this easier later, will fix that at the v2.3 stable🙂

Sincerely,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ariadne 31 Aug, 2007
I would like to thank you guys, but the code still don't work.
If i put somenthing like 7 email adress everything is fine, but if i enter the intire list (5532 characters) the form don't send.

Do you think that there's a limit of characteres?
GreyHead 31 Aug, 2007
Hi ariadne,

Looks like ChronoForms is doing it's job but something is happening in the mailer - either in the Joomla mailer or the system mailer that its feeding.

Off the top of my head I can think of two possibilities:[list]
  • that something is overloading the mailer when you send 5000 characters - around 200 addresses?? I think that's possible but unlikely.
  • that one of the e-mail addresses is faulty and is being rejected by the mailer code. If this happens the mailer just stops and the email isn't sent.
  • [/list]I think my next step would be first to double check the e-mail list - the mailer uses 'JosIsValidEmail($email)' to validate the addresses so you could run your address list through a loop and see if any get rejected.
    <?php
    address_array = array(address1, address2, . . .);
    $error_array = array();
    foreach ( $address_array as $recipient ) {
      if ( JosIsValidEmail($recipient) ) {
        $rows[0]->extraemail = $rows[0]->extraemail.",".$recipient;
      } else {
        $error_array[] = $recipient;
      }
    }
    if ( !empty($error_array) ) {
      foreach ( $error_array as $error ) {
        echo "Bad address: $error <br />";
      }
      exit();
    }
    ?>
    The 'exit()' stops the function if it finds any bad email addresses so that no emails are sent. If this doesn't show anything up then I guess that I'd go back and try a loop for the mailer so that the emails are sent to it one by one.

    Bob

    Post edited by: GreyHead, at: 2007/08/31 10:43<br><br>Post edited by: GreyHead, at: 2007/08/31 10:44
    ariadne 31 Aug, 2007
    Hi Bob,

    Im a total lamer with PHP programming .. Where should I past the code? before / after / replacing the other one in "On Submit code - before sending email:"? Or in a different page? Where could i see the 'bad' address?

    Thank's again🙂
    GreyHead 31 Aug, 2007
    Hi ariadne,

    Delete any existing code from 'On Submit code - before sending email' and paste then new code in its place.

    If you have anything in the ReDirect code fields remove it temporarily.

    Any errors should then show up on the normally blank page that you see after you submit the form.

    I can have a look for you if you like. You'd need to send me a site admin logon to 'info at greyhead.net'

    Bob
    GreyHead 01 Sep, 2007
    Later: just an update. I'm not sure if we finally got this working as it sent a couple of hundred e-mails and that makes it hard to test without spamming the recipients. I was clear that ChronoForms was working OK and that if there was any problem with the quantity of e-mails it was further down the mailer system.

    One small piece of learning from this is that the de-bugging option needs to turn off any Redirect url so that the out put is visible (or it should output to another window).

    Bob
    This topic is locked and no more replies can be posted.