Hi there, I have a dynamic form where people can submit up to 5 email addresses, I’m storing those addresses both as a placeholder and as a hook value, but the email plugin keeps throwing “An error occurred while trying to send the email. You must provide at least one recipient email address.”
But if I just add the addresses as text in the emailTo param, it sends the mails as expected
My formit declaration is as follows
<p>mails! [[+bartendersEmails]] </p>
[[!FormIt?
&hooks=`enrollBartendersFiHook,FormItAutoResponder,email,FormItSaveForm,redirect`
&emailTpl=`formSingleBartender.tpl`
&emailTo=`[[+bartendersEmails]]`
&emailSubject=`[[++site_name]]`
&fiarTpl=`fiarFormSingleBartender.tpl`
&fiarToField=`detailsEmail`
&fiarSubject=`[[++site_name]]`
&redirectTo=`48`
&redirectParams=`{"form":"[[*id]]sngl"}`
&submitVar=`sBart`
&customValidators=`customEmailHashValidate`
&formName=`Single Bartenders`
]]
The mails are listed correctly on the paragraph, yet the mail won’t be sent
The last lines of the enrollBartendersFiHook hook are:
$modx->log(modX::LOG_LEVEL_ERROR, "Lists are:\n $bartendersList \n$bartendersEmails ");
$hook->setValue(‘bartendersList’, $bartendersList);
$hook->setValue(‘bartendersEmails’, $bartendersEmails);$modx->setPlaceholder(‘bartendersList’, $bartendersList);
$modx->setPlaceholder(‘bartendersEmails’, $bartendersEmails);return true;
And in the MODx error log I’m getting the expected values.
Also checked this but not getting the mails sent,
and bascially added:
<textarea cols="50" rows="4" id="addressto_all" name="addressto_all" value="[[+bartendersEmails]]" class="hidden"></textarea>
and updated the email field to emailTo=`[[+addressTo_all]]
But I’m still getting the same error and no emails are sent, what could I be missing?
UPDATE:
From this thread I added
$hook->formit->options['emailTo'] = $bartendersEmails;
and the new error is:
[FormIt] An error occurred while trying to send
the auto-responder email: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Check the big space, like something was missing, we are in modx 2.8.1