TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   sending mails from wamp server (http://www.talkphp.com/general/4199-sending-mails-wamp-server.html)

shankar 04-28-2009 05:44 PM

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?

Wildhoney 04-28-2009 08:40 PM

Is your SMTP server address configured correctly in your php.ini file?

Code:

[mail function]
; For Win32 only.
SMTP = smtp.ntlworld.com


FSX 04-29-2009 07:31 AM

I'm not sure, but does Wamp even has a mail server?

xenon 04-30-2009 09:44 PM

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.

allworknoplay 05-01-2009 01:45 AM

Quote:

Originally Posted by xenon (Post 23538)
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.

That's why I like LAMP....however I'm sure there's a free SMTP server somewhere for Windows.

Kalle 05-03-2009 05:04 AM

Quote:

Originally Posted by allworknoplay (Post 23539)
That's why I like LAMP....however I'm sure there's a free SMTP server somewhere for Windows.

That fully depends on the package, since LAMP may not have a mail server as the stack is "Linux-Apache-MySQL-[PHP|Perl|Python]". But sure its no biggie to find a free mail server that does the job

wjgilmore 05-18-2009 05:10 PM

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

gunder 05-20-2009 05:31 PM

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.

gunder 05-24-2009 04:57 AM

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