• Hi all,

    I am doing some dev work on a WordPress website, and we would like to be able to create custom emails using the wp_mail() function. Currently the plugin is set up to work with outlook, the email tests work, and any contact forms that are being used are working as well.

    We are building a quiz where your answers will be graded, we request the user to enter their email before they can see the results. Once they have entered their email the results will be displayed and an email should be sent to them that also holds the results. I have tried a number of ways of trying to call this function within the divi code module where you can use JS.

    Can anyone help as to where I am going wrong or what can be done to be able to use this function. I have read the docs about this and many other articles, but none of them seem to really explain how you can call this function, or how it needs to be set up in the php if that is something that needs to be done. Any help that can be offered would be greatly appreciated! Thanks in advance

Viewing 1 replies (of 1 total)
  • Plugin Author Gregor Capuder

    (@capuderg)

    Hi @jordanvert,

    if you are trying to send an email via JS code, then you’ll need to perform an AJAX call, which will trigger the PHP code (with the wp_mail function).

    There is a special way on how to setup an AJAX call in WordPress. A quick google search returns this article: https://www.smashingmagazine.com/2011/10/how-to-use-ajax-in-wordpress/

    Once you have the AJAX call and you have the PHP callback function set-up. You can use the wp_mail function in this PHP callback function to send the actual email.

    Have a nice day!

Viewing 1 replies (of 1 total)
  • The topic ‘How to use the wp_mail() in connection with this plugin?’ is closed to new replies.