FormItAutoResponder not sending mails

Using formit and Akismet in a Modx 2.8.3 environment, I can’t get the autoresponder to work. This is my form header:

[[!FormIt?
   &hooks=`Akismet,FormItAutoResponder,email`
   &fiarTpl=`my-tpl`
   &fiarSubject=`Foo subject`
   &fiarToField=`mail`
   &fiarReplyTo=`...`
   &emailTpl=`mail-tpl`
   &emailTo=`...`
   &emailSubject=`foo subject`
   &emailFrom=`...`
   
   &akismetType=`contact-form`
    &akismetAuthor=`name`
    &akismetAuthorEmail=`mail`
    &akismetContent=`text`
    &akismetHoneypotField=`nospam`
    &validate=`name:required,mail:required`
]]

Everything, except FormitAutoresponder, works fine: SPAM is blocked, mails are sent upon form submit but why doesn’t the Autoresonder send any emails? There is no error in modx error history, nor are the mails being caught in SPAM on the recipient’s side. The my-tpl file also exists and only contains plain text, no references to other chunks or snippet which might brake. Any ideas anyone?

Maybe try if it helps, if you also add the properties &fiarFrom (and perhaps &fiarSender).

1 Like

Yes! After inserting these parameters (fiarFrom and fiarSender), it is now working, albeit the fact, that these parameters are marked optional according to the docs (formitautoresponder docs).

Anyways, thanks again.

In theory, &fiarFrom should get the value of the system setting emailsender if it is not set.

Unfortunately, this property exists in the default property-set with an empty value.
So you have to explicitly set this property (or delete it from the default property-set) to make it work.

$mailFrom = $this->modx->getOption('fiarFrom', $this->formit->config, $this->modx->getOption('emailsender'), true);

Sending true as a final argument to getOption() will make it use the default if the field exists, but is empty. That change would be overwritten by upgrades, but it should be fixed in the source, along with any other fields that should use the default if empty. It’s strange that it’s done with the $tpl variable, but not $mailFrom, $mailSender, or $mailFromName.

It’s unnecesary for $emailSender (though it wouldn’t hurt anything) because it’s pretty much guaranteed to be set.

I’ve filed the issue at GitHub.

1 Like