How To Send Mail From Localhost XAMPP Using Gmail - Milople

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

How To Send Mail From Localhost XAMPP Using Gmail

Magento January 21, 2021 Views: 14,809


No comment(s)

XAMPP (Cross-Platform (X), Apache, MariaDB, PHP, and Perl) is an open-


source cross-platform. Moreover, it’s a free web server solution stack package.
XAMPP is developed by Apache Friends. Since most real web worker arrange-
ments utilize similar parts as XAMPP, it makes progressing from a neighbor-
hood test worker to a live worker conceivable. Now the question is how to
send mail from localhost XAMPP using Gmail.

First, you need to configure XAMPP, once it’s installed. Then, follow the below
steps in order to send mail from localhost using Gmail.
The Steps To Send Mail From Localhost XAMPP Using Gmail:

1: Open the XAMPP installation directory.

2: Navigate php.ini file from C:\xampp\php


3: Press ctrl + f to find the mail function

4: Search & pass the below-mentioned values.

› SMTP=smtp.gmail.com

› smtp_port=587

› sendmail_from = milopleInc@gmail.com   /*Your gmail id*/

› sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

5: Open sendmail.ini file from C:\xampp\sendmail.

6: Press ctrl + f & find sendmail.

7: Search & pass the below-mentioned values.

› smtp_server=smtp.gmail.com

› smtp_port=587

› error_logfile=error.log

› debug_logfile=debug.log

› 
auth_username=milopleInc@gmail.com   /*Your Gmail id*/

› auth_password=**********   /*Your Gmail password*/


› 
force_sender=milopleInc@gmail.com   /*Optional*/

8: Script to send mail

1 <?php
2 $to_email = "receipient@gmail.com";
3 $subject = "Test email to send from XAMPP";
4 $body = "Hi, This is test mail to check how to send mail from Localhost Using Gmail
5 $headers = "From: sender email";
6  
7 if (mail($to_email, $subject, $body, $headers))
8  
9 {


10
11
    echo "Email successfully sent to $to_email...";
}
12  
13 else
14  
15 {
16     echo "Email sending failed!";
17 }

You are done! 🙂

Take heed: On the off chance that you are getting an admonition message, at
that point Please arrange “Less secure applications” settings as demonstrated
underneath. Some of the time without turning on the ‘less secure applications’
is the principal reason the client didn’t get the mail.

Know how to turn on ‘Less Secure Apps’ settings as a mailbox user:

→ Open Google Account

→ Click on  ‘Security’ from the left navigation panel

→ Turn ON from the Less secure app access panel on the bottom of the page.

→ Click “Save”.

Query solved?! If still facing the issue, write in the comment or contact us.

Get in touch with us to hire Magento Developer dedicatedly. Also, we provide


hourly-based service for any of your Magento development needs.

Keep visiting for more solutions! 🙂

Also Read:

Magento 2 XML Sitemap Configuration


How to Edit Magento Database Configuration In The Easiest Way

Share this article on your social accounts

Email*

SUBSCRIBE

Leave a Comment

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

 Your name *

 Your e-mail *

 Your comments *

Não sou um robô


reCAPTCHA
Privacidade - Termos

SUBMIT COMMENT

Blogs
Terms of Use

Videos
Privacy Policy
Knowledge Base
Career
About Us

GET IN TOUCH

CONTACT US




© 2022 Milople.com. All Rights Reserved.

You might also like