Forums

Using dropdown to select email contact not working

leisurepublishing 19 May, 2009
Howdy,

As a disclaimer, I've been through the FAQs and troubleshot this myself and I can't figure out why the email isn't being sent. I've tested the email ability of the site and you can email through the site so there's something wrong with my form settings. Here's what I have--

Debug result after sending email (Feel like the prob is probably #6)-

   1. Form passed first SPAM check OK
   2. Form passed the submissions limit (if enabled) OK
   3. Form passed the Image verification (if enabled) OK
   4. Form passed the server side validation (if enabled) OK
   5. $_POST Array: Array ( [name] => Marty Martin [email] => m@foo.com [recipients] => webmaster [subject] => test [message] => test [check0] => Array ( [0] => Send a copy to myself ) [button_10] => Submit [b9b041957006895b7f3444f8bdb1b352] => 1 )
   6. $_FILES Array: Array ( )
   7. Form passed the plugins step (if enabled) OK
   8. Debug End


Form code (related to selecting contact from select box)-

<label class="cf_label" style="width: 150px;">To:</label>
    <select class="cf_inputbox validate-selection" id="select_3" size="4" title="Please select a recipient" multiple="multiple" name="recipients">
      <option value="">Choose Option</option>
      <option value="editor">Editor</option>
      <option value="subscriptions">Subscriptions</option>
      <option value="advertising">Advertising Sales</option>
      <option value="webmaster">Webmaster</option>
    </select>


And onsubmit before email-

<?php
$emails_2 = array('editor'=>'cmodisett@foo.com', 'advertising'=>'lhouhoulis@foo.com', 'subscriptions'=>'sbarringer@foo.com','webmaster'=>'webmaster@foo.com');
$MyForm =& CFChronoForm::getInstance('main_contact');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
$MyFormEmails->setEmailData(1, 'to', $emails_2[$_POST['recipients']]);
?>


Anyone spot the problem? Thanks!
Max_admin 20 May, 2009
Hi leisurepublishing,

It looks from the debug that you don't have even 1 email setup and enabled and has a to field! you need to have at least 1, so test that your form can send one configured email fine then apply the 3rd piece of code and test it!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.