Skip to main content

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.

Comments

Popular posts from this blog

MySQL Connection

Connection with MySQL Database Before accessing database, you must create a connection to the database Syntax: mysql_connect(servername,username,password); where, servername specifies the server to connect to. Default value is “localhost” username specifies the username to log in with. Default value is the name of the user that owns the server process. To connect offline we use username “root”. password specifies the password to log in with. Default is “” Code : Creating connection to the database and selecting the required database <?php $con = mysql_connect(“localhost”,”root”,”"); if (!$con) { die(‘Could not connect: ‘ . mysql_error()); } else{ mysql_select_db(“test”, $con) }; ?> Here, we have store connection in a variable called $con and trap error using die function. Closing connection The connection will be closed automatically when the script ends. To close the connection before, use the mysql_close() function: <?php $con = mysql_conne...

Join in MySQL

Join clause is used to combine rows from two or more tables depending upon common field between them. There are different kinds of Joins. The most common and useful Join is Inner Join. Inner Join: It will return all rows from multiple tables where the condition is met.

Type Juggling and Type Casting

Type Juggling: PHP does not require (or support) explicit type definition in variable declaration; a variable's type is determined by the context in which the variable is used. That is to say, if a string value is assigned to variable $var, $var becomes a string. If an integer value is then assigned to $var, it becomes an integer.