Support » Plugin: WP Mail SMTP by WPForms » Does wp_mail() use the credentials from WP Mail SMTP?

  • Resolved drvtch0091


    I am creating my own form and wish to use the mailer settings configured by the plugin to send messages on form submission using wp_mail().

    It looks like the global $phpmailer does not contain any configuration settings when var_dumped.

    When/how can I access the object that the plugin uses to send the test email, and which sendmail method does it use? wp_mail()?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Nevermind, I see you destroy the $phpmailer at the end of wp_mail_smtp_options_page method. If I commented this out, would I be able to reference the global $phpmailer with its settings and then override the

    to, body, etc.

    fields from the form?

    Plugin Support Sanjeev Aryal


    Hi @drvtch0091,

    WP Mail SMTP reconfigures the wp_mail() function to either use proper SMTP host credentials or leverage a built-in SMTP mail provider. If you use your own phpmailer or override it, the emails will not be routed through WP Mail SMTP.

    You can override the to, body and headers from the wp_mail() function with wp_mail filter hook.

    I hope this helps!

    Plugin Support Sanjeev Aryal


    Hi @drvtch0091 – We haven’t heard from you in about a week, so I’m going to go ahead and mark this ticket resolved. If you still have questions, though, please feel welcome to continue the conversation.

    Sorry for disappearing on you! I was able to get everything working and I appreciate your reply.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.