Tuesday, December 4, 2012

Sending mail from localhost

Okay now you want to test the mail function but wait you don't have any domain name or online site to do this.

So what can you do in this situation. Simply send email from your localhost. Ya!! That's correct sending mail from your local computer and local files which are not hosted yet. And yes you can do this.

For this follow the steps below:

1) First open php.ini file.
2) Search for the mail function. When you find something like below. Okay you have found it.
3) Now configure that mail function as below:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.wlink.com.np
; http://php.net/smtp-port
smtp_port = 25

4) Okay this is good now next step. Search for the below line and configure the email address that you want to sent other emails.

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = you@yourdomain

5) Remove semicolon(;) and write your email address as below:

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = hello@gmail.com

6) Now close the php.ini file and restart the apache.

That's it. You are done.