THAPA TECHNICAL

HOUSE OF WEB DEVELOPERS AND TECHNOLOGY.

How to send mail from localhost XAMPP using PHP

How to send mail from localhost XAMPP using PHP


To send mail from localhost XAMPP using Gmail, configure XAMPP after installing it. Follow the below steps for the same.

Steps to Send Mail From Localhost XAMPP Using Gmail:

Open XAMPP Installation Directory.


Go to C:\xampp\php and open the php.ini file.
Find [mail function] by pressing ctrl + f.
Search and pass the following values:
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = YourGmailId@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"


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

Find [sendmail] by pressing ctrl + f.
Search and pass the following values
smtp_server=smtp.gmail.com
smtp_port=587 or 25 //use any of them
error_logfile=error.log
debug_logfile=debug.log
auth_username=YourGmailId@gmail.com
auth_password=Your-Gmail-Password
force_sender=YourGmailId@gmail.com(optional)

Here is the actual code that you have to write
Script To Send Mail:

<?php
$to_email = "receipient@gmail.com";
$subject = "Simple Email Test via PHP";
$body = "Hi, This is test email send by PHP Script";
$headers = "From: sender email";

if (mail($to_email, $subject, $body, $headers)) {
    echo "Email successfully sent to $to_email...";
} else {
    echo "Email sending failed...";
}



**Note: If you are getting a warning message then Please configure “Less secure apps” settings as shown below. Sometimes without turning on the 'less secure apps' is the main reason the user didn't receive the mail.

=> Turning on 'less secure apps' settings as mailbox user

Go to your (Google Account).
On the left navigation panel, click Security.
On the bottom of the page, in the Less secure app access panel, click Turn on access.
If you don't see this setting, your administrator might have turned off less secure app account access (check the instruction above).
Click the Save button.

** Now your email will be sent successfully. Have a good day and please share your story in the comment box.

154 comments:

  1. helo bhai user aur admin panal ki vidio banawo app ki sari vidio dekhat hu lekin app abhi tak admin panell par vidio nahi banaye

    ReplyDelete
    Replies
    1. how to slove this error :
      Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. r4sm6818202pjl.15 - gsmtp in C:\xampp\htdocs\DE\sendmail.php on line 7
      E-mail sending failed...

      Delete
    2. try to enable two step verification on google account and generate an app password from there and use the same password to configure sendmail.ini file and this method will work 100% rather than original password.

      Delete
  2. hello sir mere xamp server pe php.ini sho nahi kar raha hai please reply

    ReplyDelete
    Replies
    1. sirf php file hogi configuration type ki

      Delete

    2. Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\sequrelife\securelifehealthcare\Admin\sendpass.php on line 8
      Email sending failed...

      Delete
    3. Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. w11sm2782177pfc.79 - gsmtp in
      C:\xampp\htdocs\contactForm\contact-form-handler.php on line 7
      Email sending failed...

      how to solve this??

      Delete
    4. There are some files called php without int but when you open them by using editor then their name will be shown which will be either php.int.production or php.int

      Delete
  3. Email send ho raha hai local host pe par receiver pe nhi aa raha hai

    ReplyDelete
  4. hi,
    please make a video with multiple email attachement

    ReplyDelete
  5. sir as a shop ak website please a video

    ReplyDelete
  6. Wamp server pe nhi hai sendemail

    ReplyDelete
  7. After the changing the less secure apps, still the webpage says that email send successfully but the actual mail is not received on the destination.

    ReplyDelete
  8. Email send ho raha hai local host pe par receiver pe nhi aa raha hai sir please iska solution batado

    ReplyDelete
  9. Sir Email send nhi ho rahi error da raha hai.

    ReplyDelete
  10. Hello sir
    email send successfully but the actual mail is not received

    ReplyDelete
    Replies
    1. I am getting email not sent. Plz help me

      Delete
    2. Check 'All mails' tab in gmail. Please use desktop version gmail

      Delete
    3. ya, it may be on your spam folder!!

      Delete
  11. Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\sending_mail\mail.php on line 7
    Email sending failed...

    ReplyDelete
    Replies
    1. same here ..if you have done please tell me

      Delete
    2. After changes as per the description then restart the Xampp server

      Delete

    3. Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in E:\xampp\htdocs\index.php on line 7
      Email sending failed...


      solution plz???
      anyone

      Delete
  12. mere xampp pe php.ini file nhi hai...please reply

    ReplyDelete
  13. Hotmail login Most of us had heard the name of Hotmail. First free email service in the early years of the 2000s. I am sure many of you had an account there too. Today we will talk about Hotmail and also will discuss how we can use the new version of this email service in 2020.

    ReplyDelete
  14. Hey, for me, it is showing mail not sent. Plz help

    ReplyDelete
  15. Email is sent but I did not receive it

    ReplyDelete
  16. Dear sir,
    Mail is successfully send display in php but it is not received in gmail.

    ReplyDelete
  17. Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. m2sm12856062pjf.34 - gsmtp in C:\xamppServer\htdocs\WEBPRACTICE\form14\mail.php on line 7
    Email sending failed...
    not connected suggest some help

    ReplyDelete
  18. Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. h20sm3546230pfo.105 - gsmtp in F:\xampp\htdocs\ajax\mail.php on line 9
    Email sending failed...
    can you please help me sir...

    ReplyDelete
  19. This particular is usually apparently essential and moreover outstanding truth along with for sure fair-minded and moreover admittedly useful My business is looking to find in advance designed for this specific useful stuffs… hotmail login account

    ReplyDelete
  20. Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. hotmail email

    ReplyDelete
  21. hi,
    i am unable to send smail .i have followed your videos but unable to send email for recover password. no error but email sending is fail . can you reply me . its urgent . i have tried phpmailer too that too not working

    ReplyDelete
  22. I am getting this error:
    Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. l63sm3060395pfd.122 - gsmtp in C:\xampp\htdocs\registrationFormWithMail\index.php on line 53

    ReplyDelete

  23. E-mail is successfully send display in php but it is not received in gmail.

    ReplyDelete
  24. Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\search\index.php on line 8
    Email sending failed...

    ReplyDelete
  25. E-mail is successfully send display in php but it is not received in gmail.what should i do?

    ReplyDelete
    Replies
    1. Check youy 'all mails' tab in gmail

      Delete
    2. recommended to use gmail desktop version

      Delete
  26. Replies
    1. bro i'm getting msg of else condition that email.not sent.....
      help plz i have tried all settings.

      Delete
    2. Same problem is troubling me... Plzz help

      Delete

  27. Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\email.php on line 8
    Email sending failed...

    ReplyDelete
    Replies
    1. if someone solve this error plz notify us....

      Delete
  28. Mera laptop 64 bit ka hai. To mujhe kesa configuration karba hoga. Email send karne ke liye? May Bangladesh se hoon. Isliye mera hindi thura kam jor hai.

    ReplyDelete
  29. I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here. can i send a fax from my yahoo email

    ReplyDelete
  30. hello I am getting error:
    20-08-04 15:29:52 : Socket Error # 11001Host not found.

    Please help me with this!...

    ReplyDelete
  31. sir mera mai tu sending failed likh kar arha hai

    ReplyDelete
  32. Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\email.php on line 8
    Email sending failed...

    ReplyDelete
  33. Sir my email sending is failed what to do

    ReplyDelete
  34. sir my email are not sending....

    ReplyDelete
  35. Thanks for the blog post buddy! Keep them coming... how to send fax from cell phone

    ReplyDelete
  36. You made such an interesting piece to read, giving every subject enlightenment for us to gain knowledge. Thanks for sharing the such information with us to read this..........send fax from email
    send fax from email

    ReplyDelete
  37. Yahoo mail is an web based email service. Yahoo mail service can be accessed through different devices including computer, tablets, smart phones, and more. Users with a valid Yahoo account can sign into Yahoo com to access the features of Yahoo mail. A smile web browser can be used to sign into Yahoo.com. Users can also download Yahoo app to their mobile phone and login to their account. yahoo mail sign in

    ReplyDelete
  38. buy smart carts online. organic smart cart. are the high potency distillate free from any solvents. If this product was accurate with its claim.

    ReplyDelete
  39. Enrich your experience of online shopping by navigating our Skin Care products including Hair removal products, Facial cleansing brush, Epilators and much ...

    IPL HAIR REMOVER,
    FACIAL BRURSH,
    HAIR TRIMMER,
    MICRODEBRASION,
    BLACKHEAD REMOVER,
    WATERPROOF PORTABLE,

    ReplyDelete
  40. Email sending failed...
    ab kya kare ?
    sab setting sahi ki hai .
    bar bar check bhi kiya

    ReplyDelete
  41. ערות ליווי בחיפה ברמה גבוהה ביותר בישראל. נערות ליווי בצפון לביתך או מלון תוך 30 דקות אצלך. 24/7 מגוון בנות לעיסוי פרטי ברמה הגבוהה. נערות ליווי בחיפה

    ReplyDelete
  42. Royal photo Booths Australia At Royal Booths,we want to make a good impression with you, hence we go above & beyond when it comes to forming that initial relationship with our customers.

    ReplyDelete
  43. We have sell some products of different custom boxes.it is very useful and very low price please visits this site thanks and please share this post with your friends. send receive fax from cell phone android

    ReplyDelete
  44. We have sell some products of different custom boxes.it is very useful and very low price please visits this site thanks and please share this post with your friends. how to send fax from smart phone

    ReplyDelete
  45. Our store offers many styles of advanced tpe sex dolls, soft skin made of tpe material, realistic tpe sex dolls to achieve your desire for sex.Buy real realistic tpe ... realistic sex doll

    ReplyDelete
  46. I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here. receive and send a fax online

    ReplyDelete

  47. Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. u14sm13179064pfm.80 - gsmtp in C:\xampp\htdocs\email\index.php on line 7
    Email sending failed...

    error coming

    ReplyDelete
  48. Email sending failed...
    ab kya kare ?
    sab setting sahi ki hai .
    bar bar check bhi kiya
    Happy new year 2021

    ReplyDelete
  49. What does it cost to live in the Bay area? When it comes to the most desirable cities in the United States? The first city that comes to our head is the Bay Area, the panorama is breath-taking and beautiful, the weather is astonishing and the diversity is phenomenal.

    ReplyDelete
  50. 7 Coolest Offices in California

    When you first heard the word office? What is the first thing that comes into your mind?

    You must be wondering that offices only mean white walls, dark doors, and white cubicles.

    These were the days of the Grey that now has been gone.

    Nowadays, many companies invest their money in the interior of the offices because it’s truly said, “You should love the space where you work”.

    ReplyDelete
  51. 5 effective ways in which you can promote your business

    Every other business owner wants to showcase that their business is the best and they can deliver the best products and services and all they want is to put their services in front of the potential customers. However, there are many traditional ways in which one can promote business but all these traditional ways of promoting can indeed be strenuous and costly......

    ReplyDelete
  52. Key benefits of hiring a moving company in California

    The process of moving is indeed strenuous and moving across city lines is much more chaotic. Therefore, moving across California and other ...

    ReplyDelete
  53. Motivating your team in hard times


    Our store offers many styles of advanced tpe sex dolls, soft skin made of tpe material, realistic tpe sex dolls to achieve your desire for sex.Buy real realistic tpe ...

    ReplyDelete

  54. Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. u4sm3991241pga.36 - gsmtp in D:\xsmpp\htdocs\work\legalized\mailer\mailing.php on line 36
    Email sending failed...


    ReplyDelete
  55. Email sending failed...
    echo ho raha hai only, kya kre??

    ReplyDelete
  56. I am getting this problem.

    mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. q126sm5329050pfc.168 - gsmtp in..

    What should i do now ??

    ReplyDelete
  57. Showing Mail sending successfully but mail not sending

    ReplyDelete
  58. Helloo Sir, I am huge fan cum student of yours i have learnt alot from your tutorials i am facing some errors into my xammp server which are as follow:

    Error 1. The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Find out why.
    Or alternately go to 'Operations' tab of any database to set it up there.

    Error 2. A newer version of phpMyAdmin is available and you should consider upgrading. The newest version is 5.0.4, released on 2020-10-15.


    waiting for the resolution

    thank you so much

    faithxevents@gmail.com

    ReplyDelete
  59. superslop

    Superslot หรือ ภาษาไทย บ้านๆ เรียกว่า ซุปเปอร์สล็อต เราคือผู้ให้บริการสล็อตออนไลน์มีตัวเกมสล็อตให้เลือกเล่นจำนวนมากบนมือถืออันดับ 1 ทั้งฟรี

    ReplyDelete
  60. dog health
    Are you a cat or dog owner looking to maximize nourishment for your furry family members? As a pet parent, you naturally strive to provide your pets with the best lifestyle options available.

    ReplyDelete
  61. Very Bad Videos Not working

    Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. mz1sm4155221pjb.33 - gsmtp in E:\XAMP\htdocs\PHP_Connectivity\sendemails.php on line 8
    Email sending failed...

    Error Will display This Type
    waste of Time

    ReplyDelete
  62. gogo anime

    GogoAnime - Watch anime online in high quality for free. Watch anime subbed, anime dubbed online free. Update daily, fast streaming, no ads, no registration ...

    ReplyDelete
  63. Autoankauf Auf der Suche nach einem seriösen Autoankäufer in NRW sind Sie bei uns genau richtig. Wir garantieren Ihnen eine sichere und seriöse Abwicklung rund um den Autoankauf in NRW.

    ReplyDelete
  64. jandamovies Bokep Indo, Bokep Barat, Bokep Asia, Bokep Gay, Bokep Semi.

    ReplyDelete
  65. Bhai mere main port number ki error aa rhi hai jabki port no maine 587 hi daal rkha hai

    ReplyDelete
  66. Thank you for oder my Gigs. Please share the details guide in the project

    shaw internet plans

    ReplyDelete
  67. If you desire to grow your knowledge just keep visiting this web page and be updated with the latest posted here
    12v rechargeable lithium battery pack

    12 volt 18650 battery pack

    ReplyDelete
  68. kissanime The best place to watch dub and sub anime online and absolitely for free - KissAnime. With over 10000 different animes - KissAnime is the best source for anime ...

    ReplyDelete
  69. indian visa Thisare a private website offering our users online application services which include assistance with their application for Electronic Travel Authorization for travel to India. 

    ReplyDelete
  70. So, wager in your prize. First time wagers of a
    particular online casino recreation might try it first earlier than they guess their own cash
    and take the prospect at profitable the prize and even hit the jackpot.
    Jackpot Slots play like common online slots with the welcome addition of a jackpot
    prize. There are several guidelines to observe and several video games to play on the net.
    If you wish to practice before hittin
    https://www.gutdolls.com/

    ReplyDelete
  71. iam getting the below show error.. how to resolve this
    Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. o5sm5483945pjq.57 - gsmtp

    ReplyDelete
  72. visto per il canada Som en del af sin fælles aftale med USA om bedre sikring af begge landes grænser startede Canada fra august 2015 og fremad Visumfritagelsesprogram for visse lande, der er fritaget for visum hvis borgere kunne rejse til Canada ved i stedet at ansøge om et elektronisk rejseautorisationsdokument, der er kendt som eTA for Canada

    ReplyDelete
  73. how to slove this error :
    Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. r4sm6818202pjl.15 - gsmtp in C:\xampp\htdocs\DE\sendmail.php on line 7
    E-mail sending failed...

    ReplyDelete
  74. ole98fx.com OLE777 เว็บพนันออนไลน์ชั้นแนวหน้าของประเทศไทย เว็บไซต์ตรงครบวงจรทั้งยัง กีฬา คาสิโน โป๊กเกอร์ ลอตเตอรี่ สล๊อตเกมออนไลน์ ด้วยอัตราต่อรองที่ได้มาตรฐานจากค่ายที่ไว้ใจได้ OLE777 ปากทางเข้า ล่าสุด OLE777 เป็นผู้ให้บริการ ที่นำความมากมายหลากหลาย โอเล่777 casino ของการพนันกีฬา คาสิโนออนไลน์ หวยออนไลน์ เกมออนไลน์อื่นๆOLE777 ทางเข้าหลัก พนันบอลออนไลน์ คาสิโน สล็อต 2020 เว็บตรงไม่ผ่านเอเย่นต์ รับฟรีเครดิตแรกเข้า 100% ไม่ต้องฝาก ถอนได้จริง สมัครทดลองเล่นฟรี

    กดเลย : https://ole98fx.com

    ReplyDelete
  75. It is very interesting topic you’ve written here..The truth I’m not related to this, but I think is a good opportunity to learn more about, And as well talk about a different topic to which I used to talk with others Autonomous

    ReplyDelete
  76. I had done everything but forgot to restart the server. Thanks to your video I understood my silliness. It was a detailed explanation. Kudos.

    ReplyDelete
  77. Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\nayan\sendmail.php on line 13
    Email sending failed..


    what it means?

    ReplyDelete
  78. how i do integrate this code to a email form?

    ReplyDelete
  79. movie APK Download for Android Mobile, Free Download MovieRulz App Telugu, Tamil, English, Kannada for your Android TV, Android.

    ReplyDelete
  80. followed same instructions and in xampp coontrol panel go to mercury admin panel->smtp mail server set alternate port as 587
    pls note to use password as same password of your gmail(dont use special app generated password)
    turn on less secure apps access after turning off 2 step verification.so its done.
    your mail will recieve succesfully!!!!

    ReplyDelete
  81. 슈어맨, 먹튀검증
    If you violate this, we will inform you in advance that there is a request for a refund of the transaction received.

    If you have checked the precautions, please express "OK"

    ReplyDelete
  82. Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. l20sm13777895pjq.38 - gsmtp in C:\xampp\htdocs\SmartKlinic\sendmail.php on line 7
    Email sending failed...
    how to solve this?

    ReplyDelete
  83. At the point when you are fulfilled that you truly need to begin selling Big Mails, there are two viable things you should do. millions of consumer records

    ReplyDelete
  84. Everything has its own value, but this is really precious information
    토토사이트

    ReplyDelete

  85. Everything has its own value, but this is really precious information
    메이저사이트

    ReplyDelete
  86. Everything has its own value, but this is really precious information
    Baby Boutique


    ReplyDelete
  87. Everything has its own value, but this is really precious information
    Dental Implants

    ReplyDelete
  88. Basement Remodeling, Bathroom Remodeling, Custom Home, Deck Building, General Contracting, Home Additions, Home Extensions, Home Remodeling, Kitchen Remodeling, New Home Construction
    Maria Blogs


    ReplyDelete
  89. The World Is Evolving With Edutainment Robots!
    Domestic robots

    ReplyDelete
  90. hello everyone sab kuch kiya par last me email sending fail aaya please help.....:(

    ReplyDelete
  91. Everything has its own value, but this is really precious information
    SHTF

    ReplyDelete
  92. You have done a amazing job with you website
    f95zone

    ReplyDelete
  93. These websites are really needed, you can learn a lot
    sofurry

    ReplyDelete
  94. Everything has its own value, but this is really precious information
    mob psycho 100 season 3

    ReplyDelete
  95. Everything has its own value, but this is really precious information
    mob psycho 100 season 3

    ReplyDelete
  96. This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself
    sax video player all format 2021

    ReplyDelete
  97. vEverything has its own value, but this is really precious informationsites-like-upwork

    ReplyDelete
  98. i am getting this erro
    Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. bd3sm8748261edb.34 - gsmtp in C:\xampp\htdocs\sendemails\sendemails.php on line 7
    Email sending failed...

    ReplyDelete
  99. Sehen Sie sich hier die Quoten für Portugal gegen Deutschland an. Beste und aktuelle Wetten Portugal Deutschland Quote
    Portugal Deutschland Quote

    ReplyDelete
  100. Everything has its own value, but this is really precious information
    turkish citizenship by investment

    ReplyDelete
  101. Everything has its own value, but this is really precious information
    turkish citizenship by investment

    ReplyDelete
  102. I conceive this web site has got some very excellent info for everyone
    pakistan

    ReplyDelete
  103. These days, in various places, everyone is referring to themselves as verified sites
    먹튀검증

    ReplyDelete