[Forminator Pro] Ability to send emails via an Exchange account

I have a client that has many campaigns and needs some sort of form manager to run their campaigns. Forminator is perfect – except they want to be able to send HTML emails through their own exchange account and not through WP or the PHP mail function. Adding the ability to validate the email account and store all outgoing responses would be very beneficial.

  • Adam Czajczyk
    • Support Gorilla

    Hello Merlin

    I hope you’re well today!

    Forminator is more about forms (and polls an quizzes) rather than the process of sending e-mails itself. Out of the box, it will use whatever way is configured in WordPress as it’s not directly using PHP “mail()” function but rather core WP “wp_mail()” which – as a ‘wrapper” kind of function – can use different methods of delivery.

    Therefore, you can for example configure SMTP using our own Branda plugin to make e-mails (all of them) delievered via any external account. There are also built-in integrations with providers such as MailChimp, ActiveCampaign, AWeber and Compaign Monitor and even Slack and Trello. And if there’s no integration, it’s almost sure that Zapier has integration for it. And Forminator works with Zapier too :slight_smile:

    Did you look into those options already?

    If you did and you feel none of that would work for you, could you please describe the scenario a bit more for me? I’d also appreciate a lot some additional feedback on what is missing in those integrations from your point of view.

    That’ll help me a lot in describing the case to our developers :slight_smile:

    Best regards,

    Adam

  • Merlin
    • Design Lord, Child of Thor

    One more question –

    I am having an issue with the {FROM_NAME} variable working from within the template builder in Branda. It always shows up blank regardless of what I enter from Forminator.

    And is there a way to integrate google analytic events when a form is submit? I don’t see that as an option for integrations but I may be missing it.

  • Adam Czajczyk
    • Support Gorilla

    Hello Merlin

    I am having an issue with the {FROM_NAME} variable working from within the template builder in Branda. It always shows up blank regardless of what I enter from Forminator.

    I’m afraid there’s no such deep integration there yet. The FROM_NAME doesn’t really come from a Forminator (or any other plugin’s) form but rather from a FROM_EMAIL account. You should be able to configure that in “Branda -> From headers” section, otherwise default WP admin account would be used.

    And is there a way to integrate google analytic events when a form is submit? I don’t see that as an option for integrations but I may be missing it.

    As for events tracking. If you got GA code on site it’s basically a matter of adding

    ga( 'send', 'event'...)

    code to the site that’d be triggered on submission. The simplest way to do this would be to trigger it whenever someone just clicks “submit” button. There’s a plugin that lets you set that kind of tracking for pretty much every “clickable” element on the site, all you’d need would be to find a unique ID of the button element (see that plugin docs):

    https://wordpress.org/plugins/wp-google-analytics-events/

    Best regards,

    Adam

  • Merlin
    • Design Lord, Child of Thor

    Hey Adam,

    I’m afraid there’s no such deep integration there yet. The FROM_NAME doesn’t really come from a Forminator (or any other plugin’s) form but rather from a FROM_EMAIL account.

    My mistake, I thought it was coming from the info entered in the email notification section. I was able to get it done in that tab instead though so no worries!

    The simplest way to do this would be to trigger it whenever someone just clicks “submit” button.

    Correct me if I’m wrong but if I just add the GA event send code to the submit button of a form, it will trigger that event even if there is an error with the form. If I use AJAX to load an inline success message from the options in Forminator, it would be helpful to have a callback or settings to be able to trigger the GA event.

  • Predrag Dubajic
    • Support

    Hi Merlin,

    Correct me if I’m wrong but if I just add the GA event send code to the submit button of a form, it will trigger that event even if there is an error with the form. If I use AJAX to load an inline success message from the options in Forminator, it would be helpful to have a callback or settings to be able to trigger the GA event.

    I believe that you are correct about this, I’ll make a task for our devs to check it out further and see what could be done about this.

    Best regards,

    Predrag

  • Tho Bui
    • Staff

    Hey there Merlin,

    I hope you’re well today!

    I have prepared a custom snippet which you can use as a guide here :

    https://gist.github.com/wpmudev-sls/4ca2713094916e4cd29242d36c486efc

    You can download a zip, unzip it and upload file forminator-custom-event-js-on-submit-success.php to your wp-content/mu-plugins folder. If that folder doesn’t exist you can simply create it.

    After you activated this, you can add this custom function on js code to trigger event submit success:

    window.wpmudev_forminator_event_on_submit_success = function( e, formData ){
    //console.log( e, formData );
    // your custom code here
    }

    or you can use for specific form type:

    window.wpmudev_forminator_event_on_submit_form_success = function( e, formData ){
    //console.log( e, formData ); //formData see https://developer.mozilla.org/en-US/docs/Web/API/FormData
    // your custom code here
    }
    window.wpmudev_forminator_event_on_submit_quiz_success = function( e, formData ){
    //console.log( e, formData ); //formData see https://api.jquery.com/serialize/
    // your custom code here
    }
    window.wpmudev_forminator_event_on_submit_poll_success = function( e, formData ){
    //console.log( e, formData ); //formData see https://api.jquery.com/serialize/
    // your custom code here
    }

    If you are not familiar with mu-plugins you can read about them here:

    https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    or you can paste it in your child theme’s functions.php file.

    Kind regards,

    Tho Bui

    • Merlin
      • Design Lord, Child of Thor

      Hey Tho,

      I enabled the plugin and then I added the following code to a JS file that is being enqueued on the front-end but it doesn’t seem to be firing. I’m not seeing event info or form data. Am I supposed to put it somewhere else?

      function wpmudev_forminator_event_on_submit_success( e, formData ){
      console.log( e, formData );
      }

      Thanks again for the help!

  • Tho Bui
    • Staff

    Hello Merlin,

    Sorry to hear about that, there is a note here as I added on the description of this MU, this will only work if your form enabled Method Ajax. So can you go to your form setting and check it on Behaviour tab?

    And the function wpmudev_forminator_event_on_submit_success should be global, or you can try this:

    window.wpmudev_forminator_event_on_submit_success = function(e, formData){
    console.log(e, formData)
    }

    If it enabled and this still not working for you, can you send me your form page? Or that’s good if you can provide us the full access credentials to it so I could do the checks?

    Note: Don’t leave your login details in this ticket.

    Instead, you can send me your details using our contact form https://premium.wpmudev.org/contact/#i-have-a-different-question and the template below:

    Subject: "Attn: Tho Bui"
    - Site login URL
    - WordPress admin username
    - WordPress admin password
    - FTP/cPanel credentials (host/username/password)

    Kind regards,

    Tho Bui

    • Merlin
      • Design Lord, Child of Thor

      Hey Tho

      Unfortunately I cannot provide access because it’s on a local machine.

      I can say the following though:

      – The form is being submit via AJAX. I am getting a thank you message and confirmation email so I know the form is submit successfully.

      – I have a console log ensuring that the JS file with the function is being loaded.

      – An image of the: https://imgur.com/a/Q8QTh0G

      – JS code

      – MU plugin active

      – Form Behaviour

      – Confirmation JS file is loading and submission confirmation

      If there is anything else I can send, let me know.

    • Merlin
      • Design Lord, Child of Thor

      Hello Tho,

      I re-downloaded the file and installed it to the mu-plugins directory but I am still not seeing the console log when the form submits. Is there anything else I may need to add to the javascript code?

  • Tho Bui
    • Staff

    Hi Merlin,

    Can you check the MU loaded on your form page? You can check this load your form page and right click view page source, and then try to search this string wpmudev_forminator_event_on_submit_success.

    If it’s not there can you turn on debug mode and check the log file have any issue(s) there?

    Kind Regard,

    Tho Bui

  • Merlin
    • Design Lord, Child of Thor

    I see many things for forminator, but not the MU plugin code. It doesn’t look like it’s loading. I see it should be in the footer but the new stuff is not there. To verify, I cleared my log file and then tried to load the page and nothing was added to it.

  • Tho Bui
    • Staff

    Hey Merlin,

    One more thing needs to confirm, make sure are you testing on Forminator Pro and wp_footer(); is called in your footer.php file. If still not help, can you create a staging site or provide me the zip theme file so I could do the checks?

    Note: Don’t leave your login details in this ticket.

    Instead, you can send me your details using our contact form https://premium.wpmudev.org/contact/#i-have-a-different-question and the template below:

    Subject: "Attn: Tho Bui"
    - Theme download link

    You can check how to setup a staging site here:

    https://premium.wpmudev.org/blog/set-up-staging-site-cloner/

    Kind Regards,

    Tho Bui

    • Merlin
      • Design Lord, Child of Thor

      Hey Tho!

      Sorry for my delay. I was able to do some debugging over the weekend and I see that the function is being called in wp_footer but $this->list_forms on the first line of the add_custom_ga_event_on_submit_form function is empty so it returns rather than outputting the javascript. How do I go about populating list_forms? As I showed earlier, the form is published and functionally working in every aspect.

      Thanks again for all the help.

  • Tho Bui
    • Staff

    Hello Merlin,

    Sorry, I checked and confirmed the issue on case enabled Load form using AJAX in Behaviour->Rendering section. If this is your case, you can turn off it or change the third line from:

    if( is_admin() ) return;

    to if( is_admin() && ! wp_doing_ajax() ) return;

    Or you can download the MU file again.

    Hope this help!

    Kind Regards,

    Tho Bui

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.