thephpcode is where your PHP resources flow and you can find tips and tricks of PHP coding. Code snippets and examples are also provided. Best of PHP are included in thephpcode. Remember, if you have questions, do post a comment on the relevant post.

Wednesday, March 25, 2009

While I was doing a PHP project on my localhost using XAMPP, i realised I needed a local mail server in order to send out mails from my own workstation for testing. To come to think of it, XAMPP provides MercuryMail - but it's user-unfriendly interface and low level support makes it very difficult to use.

Previously when I was on Windows XP Professional Edition, I was able to install IIS with SMTP server and configure as such for PHP on Apache (XAMPP) to send out mails via IIS SMTP mail server.

However when I shifted to Windows Vista Home Premium, i realised that IIS7 do not come with a SMTP mail server. So I tried finding an alternative mail server for my computer.

I remembered about a software called hMailServer which I used on a website server. It was quite easy to use and have great UI. So i decided to give it a try. I downloaded and installed hMailServer.

To configure your computer to properly send mail, you need to do the following:1) When you first open hMailServer Administrator, you need to add a new domain.2) Click on the "Add Domain ..." button at the Welcome page. 3) Under the domain text field, enter your computer's IP, in this case it should be 127.0.0.1.4) Click on the Save button.5) Go to Settings>Protocols>SMTP and select "Delivery of Email" tab6) Enter "localhost" in the localhost name field.7) Click on the Save button.

It should then be able to send mail.

If you need to send mail using a FROM addressee of another computer, you need to allow deliveries from External to External accounts. To do that, follow these steps:1) Go to Settings>Advanced>IP Ranges and double click on "My Computer" which should have IP address of 127.0.0.12) Check the Allow Deliveries from External to External accounts checkbox.3) Save settings using Save button.

Now you should be able to send email from your PHP project using mail() function or your ASP.NET application via your own computer's SMTP mail server.

UPDATE - 1st September 09I was working with local application to send mail when I debugged that Windows Live Hotmail (the email from Microsoft) has denied all emails coming from dynamic IPs (which most residential computers are using). So this means that emails from your localhost cannot be sent to Hotmail accounts (e.g. @hotmail.com, @live.com ...). A workaround for this is for you have a Gmail account, and follow the following steps:

and save. it will relay to Google Mail and then be sent to the intended recipients. Take note that whatever you write in the From header will be replaced with your gmail address. eg. you wrote From: user@example.com, it will be replaced by Google to example@gmail.com. For more about this see http://lifehacker.com/111166/how-to-use-gmail-as-your-smtp-server

Mr. Olcay Ertaş, will you please help me on how to start up doing email server and send an email with my own contact form. I dont know where to start. I really want to learn it, i hope you'll share your knowledge with me. Hoping for a good response. Very much thanks! God Bless.

i am getting the following error after doing all what you said......Warning: mail(): SMTP server response: 530 SMTP authentication is required. in C:\wamp\www\n\mail.php on line 1what to do////////// please reply at nitsgolani@gmail.com

HiI configured hmailserver and wamp and squirrelmail in my pc, know i send mail from my hmailserver to ggmail acc then it wentoff, when i wanted to give reply to that mail its not going to the localhost i.e hmailserver.So please rectify my problem

hii...im using wamp server,and want to send an email message,but do not work,then i install hMAil server but i dnt know how i can use it......please help me to send a email msg through wamp server ,,,, i do settings in php.ini file but until its not working please tell me what can i do to send email message through wamp server

Start Overflowing

Buy author coffee!

Write In/Requests

hello all! thank you for visiting thephpcode - where php codes are shared and explained. I really hope you like the every little tips and tricks i write in just for you.

In order to keep this going, I'd really love to hear from you. If you have any compliments or feedback write them to hellclanner at gmail dot com. OR if you have any requests for tutorials or walkthroughs for PHP codes, HTML, CSS, Javascript - do write them in.

Sponsored

thephpcode choice php help and guide website/blog that allows php developers to rapidly develop their applications with the use of guides from thephpcode. choice functions and hot news about php are all here. we also have code examples shown to help you understand php better. also we include portions of mysql, apache and other technologies that you might need on your php journey. cool huh?