Dynamic To - Mailer Error

FenFire 19 Aug, 2014
Hi,
I have a problem using the mail action. Seeing the tutorials and searching forum and FAQ didn't help.
It is a form in which a user can view an offer from another user and mail to him. So I'm working with two models (Data and User) and the field value are definitely there (they show in the form fields). The "Advanced" part of the email action looks like this:

[attachment=0]email-advanced.jpg[/attachment]

I left the basic fields empty - and also tried to put Data[email] in there. All the times I get

Mailer Error: You must provide at least one recipient email address.

If I put in a dummy email in the basic tab, it looks like this:

            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:, dummy@dummy.de
                    [2] => Subject:
                    [3] => From name:
                    [4] => From email:
                    [5] => CC:User[email]
                    [6] => BCC:
                    [7] => Reply name:User[name]
                    [8] => Reply email:User[email]
                    [9] => Attachments:
                    [10] => Body: This is a test!<br /><br />IP: ::1
                )


The fields 2-4 are empty, nothing is taken from the advanced tab - and it seems the fields 5,7,8 are also not resolved. I tried User.email too, didn't work.
What is my mistake?

Thanks in advance.

Christian
GreyHead 19 Aug, 2014
Hi Christian,

Please post the rest of the debug output here.

Bob
FenFire 19 Aug, 2014
Okay, here it is:

Data Array

Array
(
    [cont] => lists
    [ccname] => Auto_leihen
    [act] => edit
    [gcb] => 1
    [chronoform] => Carsharing-view
    [event] => submit
    [Data] => Array
        (
            [name] => Data[name]
            [car] => Audi A2
            [ort] => Kreuzwertheim
            [gearsys] => Handschaltung
            [fuel] => Diesel
            [type] => Mittelklasse
            [car-details] => 
            [available] => 
            [time-standard] => 2
            [time-long] => 1
            [km_standard] => 1
            [km_long] => 1
            [kaution] => 50
            [pfand] => 
            [price-details] => 
            [contact-info] => krys80@gmail.com
            [contact-details] => 
        )

    [time_est] => 
    [km_est] => 
    [cost_est] => 
    [User] => Array
        (
            [name] => Mustermann, Thomas
            [email] => muster@muster.com
        )

    [Betreff] => Ihr Carsharing-Angebot - Nutzeranfrage
    [email-text] => This is a test
    [send] => Senden
    [ip_address] => ::1
)

Array
(
)

Errors

Array
(
)

Debug Info

Array
(
    [69] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below could NOT be sent:
                    [1] => To:
                    [2] => Subject:
                    [3] => From name:
                    [4] => From email:
                    [5] => CC:User[email]
                    [6] => BCC:
                    [7] => Reply name:User[name]
                    [8] => Reply email:User[email]
                    [9] => Attachments:
                    [10] => Body:
This is a test
                )

        )

)


If I put in a dummy email, it's like this (only debug info):
Debug Info

Array
(
    [69] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:, dummy@dummy.de
                    [2] => Subject:
                    [3] => From name:
                    [4] => From email:
                    [5] => CC:User[email]
                    [6] => BCC:
                    [7] => Reply name:User[name]
                    [8] => Reply email:User[email]
                    [9] => Attachments:
                    [10] => Body:
This is a test
                )

        )

)
GreyHead 19 Aug, 2014
Hi Christian,

I would expect User.email to work assuming that is loaded before the Email action. If not then please try adding a Custom Code action between the two with code like this:
<?php
$form->data['user_mail'] = $form->data['User']['email'];
?>
and then put user_email in the Dynamic To box.

Bob
FenFire 19 Aug, 2014
Hi Bob,

thanks for the suggestion, only it doesn't work:

PHP Custom Code so far:
<?php
$form->data['data_mail'] = $form->data['Data']['email'];
$form->data['user_mail'] = $form->data['User']['email'];
?>


Debug Info

Array
(
    [69] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below could NOT be sent:
                    [1] => To:
                    [2] => Subject:
                    [3] => From name:Mustermann, Thomas
                    [4] => From email:Mustermann, Thomas
                    [5] => CC:User.name
                    [6] => BCC:
                    [7] => Reply name:user_mail
                    [8] => Reply email:User.email
                    [9] => Attachments:
                    [10] => Body:
Test
                )

        )

)


At [8] you can see that the Point-Syntax doesn't work. [7] shows that user_mail is not resolved. And [1] shows that the Dynamic To (here data_mail) is not tranferred as a recipient.

What to do?

Regards,
Christian
GreyHead 19 Aug, 2014
Hi Christian,

Please post the whole debugger listing.

Bob
FenFire 19 Aug, 2014
Sorry, I beg forgiveness.
I just recognized in the last debug that the from part was correct. So I tried a bit more and had to realize that I named the Subjekt wrong - and the User Email is saved in User.contact-info. That's why it was empty. The basic problem that way is solved, but still there are problems with CC and reply fields (what actually is meant by reply email - it is the address the answer of recipient will be sent to - makes not that much sense, as the "from"-part is already containing that infomation). No matter what syntax I use, this fields are not resolved.
When I'm done with all my questions, I for sure will spend you some money (or buy you a coffee🙂)

Data Array

Array
(
    [cont] => lists
    [ccname] => Auto_leihen
    [act] => edit
    [gcb] => 1
    [chronoform] => Carsharing-view
    [event] => submit
    [Data] => Array
        (
            [name] => Data[name]
            [car] => Audi A2
            [ort] => Kreuzwertheim
            [gearsys] => Handschaltung
            [fuel] => Diesel
            [type] => Mittelklasse
            [car-details] => 
            [available] => 
            [time-standard] => 2
            [time-long] => 1
            [km_standard] => 1
            [km_long] => 1
            [kaution] => 50
            [pfand] => 
            [price-details] => 
            [contact-info] => krys80@gmail.com
            [contact-details] => 
        )

    [time_est] => 
    [km_est] => 
    [cost_est] => 
    [User] => Array
        (
            [name] => Mustermann, Thomas
            [email] => muster@muster.com
        )

    [betr] => Ihr Carsharing-Angebot - Nutzeranfrage
    [email-text] => Test
    [send] => Senden
    [user_mail] => muster@muster.com
    [ip_address] => ::1
)

Array
(
)

Errors

Array
(
)

Debug Info

Array
(
    [69] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:krys80@gmail.com
                    [2] => Subject:Ihr Carsharing-Angebot - Nutzeranfrage
                    [3] => From name:Mustermann, Thomas
                    [4] => From email:muster@muster.com
                    [5] => CC:user_mail
                    [6] => BCC:
                    [7] => Reply name:User.name
                    [8] => Reply email:User[email]
                    [9] => Attachments:
                    [10] => Body:
Test
                )

        )

)
GreyHead 20 Aug, 2014
Hi Christian,

Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

The email is 'from' your website; not from the User who submitted the form. If the From address does not match your site domain there is a good chance that the email will be marked as spam and dumped.

The 'Reply To' address is there so that you it will be used when you reply to the email instead of the From address.

Bob
FenFire 20 Aug, 2014
Hi Bob,

I couldn't find a way to attach something to a PM (?) or Mail via "Contact Us", so I'm doing this here.
The zip contains the backup and a small table (may be of use, I think).

I'm developing locally with XAMPP, so I can't test (or haven't tested) if the email really gets to its destiny. At least I understand the difference between "from" and "reply" now.

Thanks,

Christian

P.S. By the way, there's another question you can maybe take a look at directly (although its a different, not yet published topic).
It's about the second function in the Load JS section. It should be called on load and hide the tab container "email" if the field "contacts" doesn't have the value "email".
Max_admin 20 Aug, 2014
In the latest debug, the CC, reply name and reply email are wrong, please empty these fields.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 20 Aug, 2014
Answer
1 Likes
Hi Christian,

It took me a while to get the backup working - plus some internet connection hiccups. But it looks as though it is working correctly.

The important thing to notice is that there are both Dynamic and Static boxes in the Email action. The Static ones are those that don't have 'Dynamic' in the name.

The Static boxes take ordinary strings as values so the Reply to email box wants a value like user@example.com

The Dynamic boxes take form input names as values so the Dynamic Reply to email box wants a value like User.email

You have some input names in the Dynamic (OK) and Static (not OK) boxes.

Bob

PS I generally advise that you don't use the On Success events in actions; it's just as simple to put the 'success' actions in the main On Submit event after the Authenticator (or other action) and, imho, is much simpler to understand.
FenFire 22 Aug, 2014
Hello,
it's that easy to solve. OMG!
I got confused because I watched your (Bob's) video about emailing in CF4, and there was a static and a dynamic tab. I didn't really realize that the advanced tab is a mixture of both.

Thank you very much. It works now.

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