TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-28-2009, 05:44 PM   #1 (permalink)
The Wanderer
 
Join Date: Apr 2009
Posts: 19
Thanks: 9
shankar is on a distinguished road
Default 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?
__________________
--
Regards
Shankar
shankar is offline  
Reply With Quote
Old 04-28-2009, 08:40 PM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,215
Thanks: 90
Wildhoney is on a distinguished road
Default

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

Code:
[mail function]
; For Win32 only.
SMTP = smtp.ntlworld.com
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 04-29-2009, 07:31 AM   #3 (permalink)
FSX
The Wanderer
 
FSX's Avatar
 
Join Date: Oct 2008
Posts: 15
Thanks: 0
FSX is on a distinguished road
Default

I'm not sure, but does Wamp even has a mail server?
__________________
61924
FSX is offline  
Reply With Quote
Old 04-30-2009, 09:44 PM   #4 (permalink)
The Frequenter
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 440
Thanks: 3
xenon is on a distinguished road
Default

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.
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
Old 05-01-2009, 01:45 AM   #5 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 646
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by xenon View Post
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.
allworknoplay is offline  
Reply With Quote
Old 05-03-2009, 05:04 AM   #6 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 353
Thanks: 8
Kalle is on a distinguished road
Default

Quote:
Originally Posted by allworknoplay View Post
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
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 05-18-2009, 05:10 PM   #7 (permalink)
The Wanderer
 
Join Date: May 2009
Location: Columbus, Ohio
Posts: 10
Thanks: 0
wjgilmore is on a distinguished road
Default

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
__________________
==
Author, "Easy PHP Websites with the Zend Framework"
http://www.easyphpwebsites.com
wjgilmore is offline  
Reply With Quote
Old 05-20-2009, 05:31 PM   #8 (permalink)
The Wanderer
Good Samaritan 
 
gunder's Avatar
 
Join Date: May 2009
Posts: 20
Thanks: 0
gunder is on a distinguished road
Default

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 is offline  
Reply With Quote
Old 05-24-2009, 04:57 AM   #9 (permalink)
The Wanderer
Good Samaritan 
 
gunder's Avatar
 
Join Date: May 2009
Posts: 20
Thanks: 0
gunder is on a distinguished road
Default

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.
gunder is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i enable ssl and ssh using wamp server? sarmenhb General 2 01-11-2010 10:53 AM
Wamp working, but what next? Help! DotNetTim Absolute Beginners 3 02-07-2009 09:05 AM
ldap server Gibou Advanced PHP Programming 4 07-10-2008 10:38 AM
Running a Server CMellor The Lounge 9 12-31-2007 09:15 PM


All times are GMT. The time now is 08:01 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design