Hi,
I have a form in J1.5 with a drop down box. Based on the entry the user chooses the form sends an email to diffrent email adresses. One email template (template one) should been send to the choosen adress another template (template two) should been send to a dynamic emailadresse in my case to the email adresse the user enterd in the form.
The form works but somthimes email template one gets send to the users email adress and email template two gets send to the choosen email adress.
formcode:
On Submit code - before sending email:
I am using chronoforms 3.0 STABLE and joomla 1.5.9 german
My php version is 5.2.0-8+etch13
I hope someone can help me with my problem.
Thanks and regards,
Daniel
I have a form in J1.5 with a drop down box. Based on the entry the user chooses the form sends an email to diffrent email adresses. One email template (template one) should been send to the choosen adress another template (template two) should been send to a dynamic emailadresse in my case to the email adresse the user enterd in the form.
The form works but somthimes email template one gets send to the users email adress and email template two gets send to the choosen email adress.
formcode:
<table width="766" cellspacing="3" cellpadding="1" border="0">
<tbody>
<tr>
<td width="325"> </td>
<td width="428"> </td>
</tr>
<tr>
<td colspan="2">
<p>Good times together!<br />
<br />
Um einen reibungslosen Ablauf zu gewährleisten, bitten wir um eine Online-Reservierung mit einer <b>Vorlaufzeit von <span class="currency_converter_link" title="Convert this amount">12</span> Stunden</b>. <br />
<br />
Sollte die Vorlaufzeit weniger als <span class="currency_converter_link" title="Convert this amount">12</span> Stunden betragen, kontaktieren Sie das Restaurant bitte telefonisch. Sie bekommen nach Ihrer Online-Reservierung eine Bestätigung per E-Mail. Wir bitten daher um die Angabe Ihrer Telefonnummer, die selbstverständlich ausschließlich zu diesem Zwecke verwendet wird. Bitte beachten Sie, dass wir die Reservierung bis <span class="currency_converter_link" title="Convert this amount">15</span> Minuten nach Ihrer angegebenen Uhrzeit gewährleisten können. <br />
<br />
Wir freuen uns auf Ihren Besuch!</p> </td>
</tr>
<tr>
<td width="325"> </td>
</tr>
<tr>
<td width="325"><br><br> </td>
</tr>
<tr>
<td width="325">In welchem Restaurant möchten Sie einen Tisch reservieren?</td>
<td width="428"> </td>
</tr>
<tr>
<td colspan="2"><select id="auswahl_store" name="auswahl_store">
<option selected="selected" value="Aachen">Aachen</option>
<option value="Berlin">Berlin</option>
<option value="Bochum">Bochum</option>
<option value="Bonn">Bonn</option>
<option value="Braunschweig">Braunschweig</option>
<option value="Dortmund">Dortmund</option>
<option value="Düsseldorf - Schadowstraße">Düsseldorf - Schadowstraße</option>
<option value="Düsseldorf - Bolkerstraße">Düsseldorf - Bolkerstraße</option>
<option value="Köln - Schildergasse 83">Köln - Schildergasse 83</option>
<option value="Köln - Im Mediapark 1">Köln - Im Mediapark 1</option>
<option value="Leipzig">Leipzig</option>
<option value="Magdeburg">Magdeburg</option>
</select></td>
</tr>
<br>
<br>
<tr>
<td width="325">Datum:</td>
<td width="428"><input type="text" size="20" maxlength="150" name="datum" id="datum" title="Bitte geben Sie ein Datum ein">
<input type="reset" class="button" value="..."
onclick="return showCalendar('datum','dd-mm-y');" /> </td>
</tr>
<tr>
<td>Uhrzeit:</td>
<td><input name="zeit" type="text" id="zeit" value="hh:mm" size="20" maxlength="5" title="Bitte geben Sie eine Uhrzeit ein"/></td>
</tr>
<tr>
<td>Personenzahl:</td>
<td><input type="text" name="personen" id="personen" title="Bitte geben Sie die Besucherzahl ein"/></td>
</tr>
<tr>
<td>davon Kinder:</td>
<td><input type="text" name="kinder" id="kinder" title="Bitte geben Sie die Anzahl der Kinder ein" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="325">Anrede:</td>
<td width="428"><select name="anrede" id="anrede">
<option selected>Herr</option>
<option>Frau</option>
<option>Familie</option>
</select> </td>
</tr>
<tr>
<td>Name:</td>
<td><input type="text" name="name" id="name" title="Bitte geben Sie Ihren Namen ein" /></td>
</tr>
<tr>
<td>Vorname:</td>
<td><input type="text" name="vorname" id="vorname" title="Bitte geben Sie Ihren Vorname ein"/></td>
</tr>
<tr>
<td>Straße:</td>
<td><input type="text" name="strasse" id="strasse" title="Bitte geben Sie Ihre Straße ein" /></td>
</tr>
<tr>
<td>PLZ:</td>
<td><input type="text" name="plz" id="plz" title="Bitte geben Sie Ihre PLZ ein"/></td>
</tr>
<tr>
<td>Ort:</td>
<td><input type="text" name="ort" id="ort" title="Bitte geben Sie Ihren Ort ein" /></td>
</tr>
<tr>
<td>E-Mail:</td>
<td><input type="text" name="email" id="email" title="Bitte geben Sie Ihre E-Mail ein"/></td>
</tr>
<tr>
<td>Telefonnummer:</td>
<td><input type="text" name="telefon" id="telefon" title="Bitte geben Sie Ihre Telefonnummer ein"/></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Bemerkung:</td>
<td><textarea name="bemerkung" id="bemerkung" cols="45" rows="5"></textarea></td>
</tr>
<tr>
<td><small>Bitte übernehmen Sie den nebenstehenden Text.</small></td>
<td>{imageverification}</td>
</tr>
</tbody>
</table>
<input type="submit" name="senden" id="senden" value="Reservierung absenden" />On Submit code - before sending email:
<?php
if(JRequest::getVar('auswahl_store') == 'Aachen')$emails[0]->to = 'email1,email2,email3';
if(JRequest::getVar('auswahl_store') == 'Berlin'){$emails[0]->to = 'email4,email5,email6';}
[...]
I am using chronoforms 3.0 STABLE and joomla 1.5.9 german
My php version is 5.2.0-8+etch13
I hope someone can help me with my problem.
Thanks and regards,
Daniel
Hi Daniel,
I think we need to see the whole thing.
[sendfb][/sendfb]
Bob
thanks for your help!
I've send you an email
Hi Daniel,
Sorry for the delay - it took me a while to re-create the error and even longer to try to work out what is happening.
I think that there is a ChronoForms bug here with the way that multiple emails are handled. They are stored in a separate database table and recalled using
The problem arises if you are trying to re-write using $emails[0]->to with multiple emails because you can't be sure which order they will be returned from the database. Most of the time it will be 'a', 'b' but it could be 'b', 'a' and then $emails[0]->to will be applied to the wrong email.
As a workaround I suggest that you hack chronocontact.php around line 380 and replace the line above with
Bob
PS Whilst digging into this I went down a false trail of thinking that there might be some cases where the if clauses weren't being applied. I re-wrote them as a switch - not needed but it's easier to maintain than your version so I offer it to you
Sorry for the delay - it took me a while to re-create the error and even longer to try to work out what is happening.
I think that there is a ChronoForms bug here with the way that multiple emails are handled. They are stored in a separate database table and recalled using
$query = "SELECT * FROM #__chrono_contact_emails WHERE formid = '".$rows[0]->id."'";This is fine when there is only one email, it's also fine when there are more than one **as long as you aren't trying to re-write the email values**. The problem arises if you are trying to re-write using $emails[0]->to with multiple emails because you can't be sure which order they will be returned from the database. Most of the time it will be 'a', 'b' but it could be 'b', 'a' and then $emails[0]->to will be applied to the wrong email.
As a workaround I suggest that you hack chronocontact.php around line 380 and replace the line above with
$query = "SELECT * FROM #__chrono_contact_emails WHERE formid = '".$rows[0]->id."' ORDER BY emailid ";This should ensure that the emails are always returned as 'a', 'b' and the re-write will be applied to the correct email.Bob
PS Whilst digging into this I went down a false trail of thinking that there might be some cases where the if clauses weren't being applied. I re-wrote them as a switch - not needed but it's easier to maintain than your version so I offer it to you
<?php
$store = JRequest::getVar('auswahl_store');
$email_array = array();
switch ($store) {
case 'Aachen':
$email_array[] = 'aachen.588@pizzahut-antons.de';
$email_array[] = 'winfried.heinrich@pizzahut-antons.de';
break;
case 'Berlin':
$email_array[] = 'berlin.181@pizzahut-antons.de';
$email_array[] = 'winfried.heinrich@pizzahut-antons.de';
break;
case 'Bochum':
$email_array[] = 'bochum.139@pizzahut-antons.de';
$email_array[] = 'regis.bonnemain@pizzahut-antons.de';
break;
case 'Bonn':
$emails[0]->to = 'bonn.286@pizzahut-antons.de';
$email_array[] = 'winfried.heinrich@pizzahut-antons.de';
break;
case 'Braunschweig':
$email_array[] = 'braunschweig.594@pizzahut-antons.de';
$email_array[] = 'christian.schweers@pizzahut-antons.de';
break;
case 'Dortmund':
$email_array[] = 'dortmund.107@pizzahut-antons.de';
$email_array[] = 'regis.bonnemain@pizzahut-antons.de';
break;
case 'Düsseldorf - Schadowstraße':
$email_array[] = 'duesseldorf.136@pizzahut-antons.de';
$email_array[] = 'regis.bonnemain@pizzahut-antons.de';
break;
case 'Düsseldorf - Bolkerstraße':
$email_array[] = 'duesseldorf.183@pizzahut-antons.de';
$email_array[] = 'regis.bonnemain@pizzahut-antons.de';
break;
case 'Köln - Schildergasse 83':
$email_array[] = 'koeln.165@pizzahut-antons.de';
$email_array[] = 'winfried.heinrich@pizzahut-antons.de';
break;
case 'Köln - Im Mediapark 1':
$email_array[] = 'koeln.285@pizzahut-antons.de';
$email_array[] = 'winfried.heinrich@pizzahut-antons.de';
break;
case 'Leipzig':
$email_array[] = 'leipzig@pizzahut-antons.de';
$email_array[] = 'ilona.antons-sieben@pizzahut-antons.de';
break;
case 'Magdeburg':
$email_array[] = 'magdeburg.545@pizzahut-antons.de';
$email_array[] = 'ilona.antons-sieben@pizzahut-antons.de';
break;
default:
break;
}
$email_array[] = 'susanne.schlanstedt@pizzahut-antons.de';
$emails[0]->to = implode(',', $email_array);
?>
Hi Bob,
good Catch, thanks!!🙂
Regards,
Max
good Catch, thanks!!🙂
Regards,
Max
This topic is locked and no more replies can be posted.
