PressTigers

Integrating SMTP into WordPress Without Using a Plug-in

The wp_mail function is implemented using the PHPMailer class to send emails. By default, there is a hard coded $phpmailer->IsMail(); function call that enables the PHPMailer class to use native PHP mail function. This is why, the wp_mail function ultimately use PHP mail functions to send emails.

You can also setup PHPMailer to send email through SMTP using the phpmailer_init action. In this article, you will learn a simple way to integrate SMTP into WordPress without using any plug-in. The phpmailer_init action calls right before sending an email so that you can override all the parameters and functions associated with PHPMailer. You just need to pass PHPMailer object to the function and update all the parameters there.

 

User Comments

10 thoughts on “Integrating SMTP into WordPress Without Using a Plug-in

    Serdar says:

    Hello,

    Should add I this code to functions.php of theme?

    Help me please!

      Hello Serdar,

      Yes, you have to put this code in your theme’s “function.php” file and write your details accordingly. And then call it in “phpmailer_init” WP action hook.

      Thank you for contacting us. Please let us know if you need any further assistance.

      Regards,
      Ahmed | Associate Plugin Developer
      Email: support@presstigers.com

    Roman says:

    Hello! Maybe, do you know, how can i add two email settings?
    I have uses contact form 7 and woocommerce. And i want to send contact form emails from 1 mail (info@domain.com) and woocommerce emails from 2 mail (orders@domain.com).

      Hello Roman,

      It is one email account solution. If you want to add two accounts then please contact us at support@presstigers.com to avail of our services for these modifications.

      Thank you for reaching us out. Let us know if we can assist you further.

      Regards,
      PressTigers Support Team

    hema says:

    should i need to define the smtp port details in the wp_config.php file?
    help me..

    hema says:

    I need to send email, by using wp_mail () for the button click event in the plugin, and new to WordPress, how can i acheive this task? .Give me a guidance.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get in Touch