Thursday, April 17, 2014

Send email using Xampp from localhost


I always had problem for testing my PHP codes which were include mail function. I used to upload them on server to test them. But today I decided to find the way to send the mail with PHP using XAMPP from localhost and I found the solution. Then I decided to share this simple tip with you guys. Before we start the procedure you need to have an email address on a running mail server such as Yahoo, Gmail or any other server that you have access to configuration of them as well, because we need their port number.

  1. First go to the path that you installed Xampp application. By default it is "C:\xampp\".
  2. Then we need to find the php.ini file which contains the configurations belong to PHP. This file by default is located at "C:\xampp\php\php.ini". Open it using any text editor like notepad.
  3. Using search in the editor try to find "sendmail_path". There should be two of them. One is commented using a ";" (semicolon) in the beginning of the line , and the other one is not commented. Comment the one that is active and active the one is commented. After the edit it should looks like below... (Similar)
    sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
    ; XAMPP: Comment out this if you want to work with mailToDisk,...
    ;sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
  4. Save the php.ini file and restart the Apache process. This is necessary for the configuration to take place.
  5. Next navigate to the sendmail directory. By default it should be located at "C:\xampp\sendmail" and open the "sendmail.ini" in the text editor.
  6. Now we need to set the configuration for the mail server. For this case I chose Gmail. The SMTP address of Gmail is: "smtp.gmail.com" and the SMTP port for Gmail is "587".
  7. Find "smtp_server" and write the Gmail SMTP address in front of that.
  8. Find "smtp_port" and write the Gmail SMTP port in front of that.
  9. Scroll down , you should be able to see "auth_username" & "auth_password". Put your gmail username in front of  auth_username and put the password in front of auth_password .
  10. Save and now you are good to send mail from local host. 
  • Note that your PHP mail function should have "from" header,otherwise your mail will not go through. 
  • Also remember the that the destination will receive the mail from your Gmail address not from the address you put in your PHP code.
  • The following code is a simple example of PHP script which can send a successful mail.
<?php
$subject = "The mail subject goes here";
$content= "And this is the mail content!";
$headers = "From:[email protected]\r\n";

mail($to,$subject,$content,$headers);
?>

THIS MAY NOT WORK ON SOME OF WINDOWS 8 OR 8.1 DUE TO THE SECURITY LIMITATION.
Please make sure your firewall, antivirus or other security software is not stopping the sendmail.exe to communicate with internet!

81 comments:

  1. This is a good post. This post gives truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. Thank you so much. Keep up the good works. instant instagram likes uk

    ReplyDelete
  2. Efficiently written information. It will be profitable to anybody who utilizes it, counting me. Keep up the good work. For certain I will review out more posts day in and day out. https://hotmail.inf.br/

    ReplyDelete
  3. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! hotmail

    ReplyDelete
  4. As consistently the great and the evil resemble different sides of a coin. In spite of the fact that the focal points exceed the detriments it's about time that we investigated them before they spread.cyber security in hyderabad

    ReplyDelete
  5. Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. hotmail entrar

    ReplyDelete
  6. Many users of this new manner of faxing will gladly factor out other advantages of on line faxing.fax documents online encryption

    ReplyDelete
  7. Sophisticated surveillance cameras are common place in premise security but 24 response app there is still a need for "human eyes" and many businesses do not have any real alternative to footing the bill for security guards.

    ReplyDelete
  8. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. how to send fax from phone

    ReplyDelete
  9. If you've ever gone to a website and were asked for your email address in exchange for a free product or download, then you've seen this in action.best email extractor software review

    ReplyDelete
  10. 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
  11. 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 fax from phone

    ReplyDelete
  12. You will have the option to spare long stretches of exploration time as this kind of programming can accomplish this work without anybody at the PC. Bulk Email Sender

    ReplyDelete
  13. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... email extractor vs atomic

    ReplyDelete
  14. Your content is nothing short of bright in many forms. I think this is friendly and eye-opening material. I have gotten so many ideas from your blog. Thank you so much. how to send 1000 mail at once

    ReplyDelete
  15. Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign. امنیت سایبری

    ReplyDelete
  16. Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing safety n home

    ReplyDelete
  17. Excellent website! I adore how it is easy on my eyes it is. I am questioning how I might be notified whenever a new post has been made. Looking for more new updates. Have a great day! one funnel away challenge

    ReplyDelete
  18. This article was written by a real thinking writer without a doubt. I agree many of the with the solid points made by the writer. I’ll be back day in and day for further new updates. cctv camera

    ReplyDelete
  19. I heard about this naming agency from several people that it gives online courses in making company names. With their information-rich lessons, you will never run out of creative ideas. Email Harvester

    ReplyDelete
  20. It has fully emerged to crown Singapore's southern shores and undoubtedly placed her on the global map of residential landmarks. I still scored the more points than I ever have in a season for GS. I think you would be hard pressed to find somebody with the same consistency I have had over the years so I am happy with that. Security guards London

    ReplyDelete
  21. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... ClickFunnels Vs Kartra

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
  23. Nonetheless, when she will claim her own PC, it is an ensured that her perspective on technology will change.Access Control System

    ReplyDelete
  24. I think this is one of the most significant information for me. And i’m glad reading your article. But should remark on some general things, The web site style is perfect, the articles is really great : D. Good job, cheers https://www.deathbycaptcha.com/2captcha

    ReplyDelete
  25. Very good topic, similar texts are I do not know if they are as good as your work out. CBT Mass Email Sender

    ReplyDelete
  26. I am unable to read articles online very often, but I’m glad I did today. This is very well written and your points are well-expressed. Please, don’t ever stop writing. 2captcha api

    ReplyDelete
  27. I would recommend my profile is important to me, I invite you to discuss this topic... vape attic olathe

    ReplyDelete
  28. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. trends topics

    ReplyDelete
  29. Email promoting administrations give viable and simple approach to get accomplishes wanted advertising objectives. Through Email benefits your message or administrations is shipped off clients. It's likewise assists with developing relationship with the clients by customized and pertinent email correspondences. Email showcasing is a best and least expensive approach to disseminate your business messages to clients or public portion by means of mailer (email). what is email marketing

    ReplyDelete
  30. Excellent read, Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. email search engine

    ReplyDelete
  31. On this page, you'll see my profile, please read this information. How do I scrape emails from Google Maps?

    ReplyDelete
  32. It is somewhat fantastic, and yet check out the advice at this treat. try here

    ReplyDelete
  33. As explained earlier, social media sites like Facebook and Twitter are superb ways to connect with both existing and potential clients. email marketing software

    ReplyDelete
  34. This comment has been removed by the author.

    ReplyDelete
  35. I think this is one of the most significant information for me. And i’m glad reading your article. private nursing

    ReplyDelete
  36. wow, great, I was wondering how to cure acne naturally. and found your site by google, learned a lot, now i’m a bit clear. I’ve bookmark your site and also add rss. keep us updated. buy crypter

    ReplyDelete
  37. Web page hosting is one of the leading internet businesses because all web pages need a hosting service provider. With thousands of web hosting companies to choose from, how are you to decide on one to host your web site? https://onohosting.com/

    ReplyDelete
  38. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work https://www.tumblr.com/blog/security-company-in-singapore

    ReplyDelete
  39. Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. security guard company in Singapore

    ReplyDelete
  40. Very interesting to read this article. I would like to thank you for the efforts you had made for writing this awesome article. Penetration Testing Services

    ReplyDelete
  41. This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again. security guard agency

    ReplyDelete
  42. Those that wish to publish a website will not get very far when if they do not have access to a decent website hosting plan in place. Actually, there are those that may not wish to even think about website hosting due to the costs associated with it. But, does there really have to be a great cost with website hosting? https://hostinglelo.in/

    ReplyDelete
  43. Wonderful blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it. security companies in singapore

    ReplyDelete
  44. If you are looking for more information about flat rate locksmith Las Vegas check that right away. security alarm

    ReplyDelete
  45. Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. singapore security alarm

    ReplyDelete
  46. Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. Prince Security Company

    ReplyDelete
  47. Great post, you have pointed out some excellent points, I as well believe this is a very superb website. cambodia security company

    ReplyDelete
  48. An invite email is an extraordinary method for presenting both cold and warm prompts your administrations. Your client might have selected in at an open house or your site, or they might be somebody you've overcome a reference. gmx mail

    ReplyDelete
  49. another thing or in any event, giving coupons to esteemed clients. The course in which they do this is to gather email addresses from current clients and expected clients. The best course to do this is to have an assortment region on your site. For instance, a source of inspiration box that permits clients or expected clients to pursue email offers. This permits you to lawfully get the email address and utilize this to send email marketing material to. GMX Mail How to Create an Account

    ReplyDelete
  50. It is a fantastic post – immense clear and easy to understand. I am also holding out for the sharks too that made me laugh. private security company

    ReplyDelete
  51. This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post.! security services

    ReplyDelete
  52. nice bLog! its interesting. thank you for sharing.... prince security service

    ReplyDelete
  53. Thanks for sharing the post.. parents are worlds best person in each lives of individual..they need or must succeed to sustain needs of the family. security guard company in cambodia

    ReplyDelete
  54. I am very happy to discover your post as it will become on top in my collection of favorite blogs to visit. security services company to hire

    ReplyDelete
  55. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me. Uniarch

    ReplyDelete
  56. buy twitch followers First of all, the Settlers of Catan game by Mayfair Games is a break-away, best selling game for a very good reason. It is just perfect for family play because nobody gets eliminated. And the players that are behind are still playing but they can pursue different goals. It is a very easy game to learn how to play. It is a strategy game that again, is very family friendly (important!).

    ReplyDelete
  57. https://hostinglelo.in The amazing development of hi-tech Internet gaming technology has enabled the successful duplication of the excitement of the popular game of golf online. Online golf games certainly appeal to dedicated golf players, but they have also reached out to a new audience of players who have never played classic golf but are drawn by the color and thrill of the Internet game.

    ReplyDelete
  58. Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also Website Design Cambridge

    ReplyDelete
  59. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... https://teresasean9.wixsite.com/my-site/post/benefits-of-being-a-school-security-guard

    ReplyDelete
  60. Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. cambodia security company more info here

    ReplyDelete
  61. Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. private security company

    ReplyDelete
  62. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. security service in cambodia

    ReplyDelete
  63. Thanks for sharing the post.. parents are worlds best person in each lives of individual..they need or must succeed to sustain needs of the family. security company in cambodia

    ReplyDelete
  64. Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog. read here

    ReplyDelete
  65. Keep up the good work; I read few posts on this website, including I consider that your blog is fascinating and has sets of the fantastic piece of information. Thanks for your valuable efforts. best security company

    ReplyDelete
  66. I havent any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. Singapore best security alarm

    ReplyDelete
  67. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. security service company in cambodia

    ReplyDelete
  68. I have bookmarked your blog, the articles are way better than other similar blogs.. thanks for a great blog!+B203:B223 but cctv camera singapore

    ReplyDelete
  69. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... best security guard company in sihanoukville

    ReplyDelete
  70. Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. alarm monitoring system

    ReplyDelete
  71. i never know the use of adobe shadow until i saw this post. thank you for this! this is very helpful. https://security-company21.mystrikingly.com/

    ReplyDelete
  72. It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks. buy alarm monitoring system

    ReplyDelete
  73. Hello, this weekend is good for me, since this time i am reading this enormous informative article here at my home. security guard sihanoukville

    ReplyDelete
  74. Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. security guard phnom penh

    ReplyDelete
  75. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. best security services

    ReplyDelete
  76. Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks best khmer security company

    ReplyDelete
  77. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... trusted security guard services

    ReplyDelete
  78. It is a great website.. The Design looks very good.. Keep working like that!. https://fiyara6614.wixsite.com/my-site/post/uniform-security-guard

    ReplyDelete
  79. I loved your blog post. Really thank you! Will read on...
    card access system price

    ReplyDelete

Social Networks Sharing