How to configure mail from localhost ( wamp ) using PHP?
I have searched a lot when I was required to configure mail using my localhost for my project. At many sites I have read that it’s just not possible to send mail using localhost. You have to upload your project on the net.
But after searching a lot I get to know that it’s possible to send mail using localhost without uploading the project. And today I post this blog so that the PHP programmer can get to know that it’s not that we just cannot send mail from localhost .We can do.
Steps to send mail from localhost:
- Search for mail function in that file and replace its content as follow.
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = your serve’s host name. (ex. mail.test.com)
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = Sender email Id .(ex. [email protected]
- Save the php.ini file.
- Write code to send mail.
<?php
$to = ’[email protected]’;
// subject
$subject = This is the Test mail’;
// message
$message = ’
<html>
<head>
<title>Test message</title>
</head>
<body>
<p> Hey its working!.. ..</p>
</body>
</html>
‘;
// To send HTML mail, the Content-type header must be set
$headers = ’MIME-Version: 1.0′ . ”\r\n”;
$headers .= ’Content-type: text/html; charset=iso-8859-1′ . ”\r\n”;
// Additional headers
$headers .= ’To: Receiver name <[email protected] >’ . ”\r\n”;
$headers .= ’From: Sender name <[email protected]>’ . ”\r\n”;
// Mail it
mail($to, $subject, $message, $headers);
?>
You are done with the steps. Now run your wamp and continue your project further.
You may like to read this also....
12 Comments to “How to configure mail from localhost ( wamp ) using PHP?”
Post comment
Search in this website
our sponsors
latest comments
- sagar on List of all standard version of c language
- Mohit Dhukia on How to access/unblock songs.pk in india?
- shinto peter on How to configure mail from localhost ( wamp ) using PHP?
- tammylleanne on Implementation limitation of c programming language
- Deepak on How to access/unblock songs.pk in india?
Find us on Facebook
Top Authors
Find us on stackoverflow
Polls
My Bookmarks
- Audio/video Recorder & player application based on MATLAB
- check dependency of your binary
- defination of all standard c programming language function
- Great Question-Answer on c programming
- know what your c code means
- Limition of c programming language
- List of all version of c programming language
- Online c compiler
- php freelancing work
- some more stuff on C programming language
- Volatile Keyword in Embedded System
- Write Android application in c language
Nice article Arpi
Keep it up !!!
Hello all. I agree with you – 100% +. Thank you for the information. Bruce.
Good One!!!!!
This is excellent! How do you uncover these items?
Keep working ,splendid job!
Hi,
Not working for me. I am using gmail smtp for sending mails.
any body help me for this
Thanks!
I AM NEW TO PHP. I CREATED WEBSITE LOCALY. I CREATED ONLINE TEST. I WANT TO SEND SCORE TO USER WHO ATTEND THE EXAM. HOW SHOULD I DO.
Arpi nice work tutorial its mine check out
sureshranju recently posted..drop down menu does not display my information from my mysql database
http://askhowtofix.blogspot.in/2013/03/php-mail-function-not-working-in.html
Hello there, it really a very simple and nice way to send email but when I tried it i am getting the following error
ning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. t16sm13728702pbs.32 – gsmtp in C:\wamp\www\tp\forgot.php on line 27
Any help??
can u please help me
i have tried above setting but iam getting following error message
Warning: mail() [function.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:\wamp\www\mail\index2.php on line 29
Useful information Arpi. Thanks!!