Forums

email to different addresses with dropbox

Fredolino 01 May, 2016
Hello,

I want a selected person send an email.
As a basis I "How can I send an email to different addresses?" from the FAQ.

Unter "Designer" have i
Dropbox
Field Name: concierge[weiterleitung]
Field ID: weiterleitung
Options:
em1=Fred
em2=Sven
em3=Thomas
em4=Pereira
em5=Annette
em6=Karl

Unter "Setup" have i in "On submit" a Custom Code:
<?php
// set a default weiterleitung
$recipient = 'em1';
if (isset($form->data['weiterleitung']) && $form->data['weiterleitung'] ) {
$recipient = $form->data['weiterleitung'];
}
$emails = array (
'em1' => 'info@fred.de',
'em2' => 'info@sven.net',
'em3' => 'admin@thomas.com',
'em4' => 'admin@elena.com',
'em5' => 'admin@annette.com',
'em6' => 'info@depp.de');
$form->data['email_to_use'] = $emails[$recipient];
?>


Email-Action:
Basic
Enabled: Yes
Subject:---
From name:---
From email:---
Format: HTML
Template:auto

Advanced
Dynamic To: email_to_use

The Debugger:

 [button5] => Submit
    [email_to_use] => info@fred.de
    [id] => 1
    [ip_address] => XXXXX
    [Chronoconnectivity] => Array
        (
        )
)


Could it be something with the CC5?
Or do I have the model names: concierge to add?
It is only the first line of the selected Dropbox, although I got selected 6.Person. And an e-mail also does not matter.

Thanks in advance.
F.
GreyHead 07 May, 2016
Hi Fedolino,

Your dropdown is called concierge[weiterleitung] but the Custom Code is checking weiterleitung so the default value em1 is always used.

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