![]() |
sending mails from wamp server
<?php
$to = $_POST['address']; $subject = "Email from websitename.com"; $name = $_POST['name']; $headers = "From: admin@websitename.com"; if ($name&&$to) { $message = "If you are able to view this message, then your request for a confirmatory email was successful.\n \t <a href='http://localhost/phpmyresources/addacc.php'>Click here to register yourself</a>"; $body = "Hello $name \n\n\t $message"; mail($to, $subject, $body, $headers); } ?> <br>Email sent <br><br><a href="send_email.php">Back</a> But the output says mail sending failed, what to do? |
Is your SMTP server address configured correctly in your php.ini file?
Code:
[mail function] |
I'm not sure, but does Wamp even has a mail server?
|
You need to install a SMTP or POP server on the server running that application, first of all. Then configure the php.ini file (SMTP section is there, I don't know about POP, never worked with that).
@FSX: no, it does not have one. |
Quote:
|
Quote:
|
Hi Shankar,
Wildhoney is correct; you'll need to identify an SMTP server within the php.ini file, because Windows does not come with a built-in mail server. However, to minimize the hassle I suggest using the PEAR Mail package (http://pear.php.net/package/Mail) as it allows you to pass along other authentication information which is often required by mail servers to prevent spamming. For instance you could easily use the Mail package to authenticate to Gmail and send email through your Gmail account. Hope this helps, Jason |
I read an article just a couple of days ago about setting up a simple mail server on your own machine to test out PHPs mail functions. I'm drawing a blank now on what server was used. I'll see if I can find it for you.
|
Shankar, I don't know if you still need help with this or not but I found the article again .. http://www.phpeasystep.com/phptu/23.html . It's just a simple little tutorial that tells you how to set up this mail server on your local machine (http://argosoft.com/rootpages/MailSe...T/Default.aspx) and gives you a little php script so you can test and see if it is working properly or not. Hope this helps.
|
| All times are GMT. The time now is 11:34 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0