Hi there! Another blog that I hope can be of help. In this article, we will be using XAMPP as our local webserver. If you don’t have this software yet, you can go to apachefriends.org/index.html. I recommend to download the latest version of PHP. Cheers!

Steps:

1. Open XAMPP directory. C:\xampp

2. Go to C:\xampp\php and open the php.ini file. Or you could open the XAMPP control panel, click on “Config” button at the Apache column, then click on php.ini


3. Find or search the following lines then configure

  • line 1084: SMTP=smtp.gmail.com
  • line 1086: smtp_port=587
  • line 1090: sendmail_from = your.email@gmail.com
  • line 1094: sendmail_path =”\”C:\xampp\sendmail\sendmail.exe\” -t”

If they have a semicolon “;” before the words, remove it. Save the file, exit.

4. Now, go to C:\xampp\sendmail and open sendmail.ini file.

5. Find or search the following then configure

  • smtp_server=smtp.gmail.com
  • smtp_port=587
  • error_logfile=error.log
  • debug_logfile=debug.log
  • auth_username=your.email@gmail.com
  • auth_password=youremailpassword

if they have a semicolon “;” before the words, remove it. Save the file, exit.

6. Every time you configure your php.ini file, restart Apache for it to take effect. By restarting, it doesn’t mean exiting the controller then opening it again.

7. Go to the controller, click the stop button, wait for it to become “Start”, then click on it again hehehe restart.


8. Or you know, you can quit the whole controller then open everything again. It’s your choice really. Quit button? Yes, not the “X” at the top right.


After all that shinanigans, lol, now we test it. Below are sample snippets on how to send emails using WordPress

How To Send Email In WordPress

<?php

$subject = 'ARK Web Creatives - How to Send Email in WordPress using Localhost';

// Receiver of the email
$to = 'recipient@gmail.com';

// Sender of the email
$from_name = 'From: myemail@gmail.com';
$reply_to = 'Reply-To: myemail@gmail.com';

// This is to make sure that the email will be using HTML to display the body content.
$head = 'Content-Type: text/html; charset=UTF-8';

// Header of the email
$head .= $from_name.' <'.$from_email.'>'.$reply_to;
$head .= 'X-Mailer: PHP/' . phpversion();

// Since we setup the header to use html, we can now add the body like this
$email_body = '<h1>Welcome!</h1><br><p>I hope you learned something in this short article.<br> Good luck!</p><br><br>';
$email_body .= 'Yours truly,<br>Ryner Galaus | AWC';

wp_mail( $to, $subject , $email_body, $head );

?>


That’s all for this post. Again, if you find this article informative or interesting, you can share it with your fwends. hihi

If you have any suggestions or comments regarding this article or if you have any topic you’d like to ask, comment below. Let’s be friends! haha

Some additional

If you are building your own website or you are creating for someone else, and you happen to be looking for a hosting provider. I would like to recommend Hostinger. Cheers!


Ryner Galaus

Ryner SG

An ordinary person with a tiny brain hoping to be useful in his own way. A homebody hoping to one day create and build his dreams while in service to people. An underachiever who was once called nobody slowly growing up. A web developer learning and earning his way through life. Ryner is what my family and friends call me, and I hope you do too. By the way, I am also affiliated with Frontrow International, so for inquiries or orders, message me.

0 Comments

Leave a Reply

Avatar placeholder

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