Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
| Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 12th, 2006, 01:42 PM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can i send mail with php?

Hi ,
i use the following php code to send mail :
<?php
$to = "karo21@walla.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
 } else {
  echo("<p>Message delivery failed...</p>");
 }
?>

It writes the success message - but it doesn't send the mail . What do i need do do or change to solve this problem ?


 
Old July 12th, 2006, 01:45 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

The first question would be as to whether there is an email server linked to your webserver?

I have a testing server at home that gives a success, but never sends the email, because I don't have a mail server running.

The same code however works like a charm with my hosting service, which does.

HTH

Mike

Mike
EchoVue.com
 
Old July 12th, 2006, 01:53 PM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Before i tried to put it on hosting - i tried to do it in my local computer - and it didn't work .
So how can install the mail server?
And i must say that i saw a lot of examples on other hostings that should work , but they didn't work .

 
Old July 12th, 2006, 02:06 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

I'm not really sure... If you need a place to test it, I would be happy to upload it to my web-space and you could test it from there...

Mike

Mike
EchoVue.com
 
Old July 13th, 2006, 03:22 AM
Friend of Wrox
 
Join Date: Jan 2006
Location: San Francisco, CA, USA.
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for posting this question in two forums, Paula.

Jon Emerson
http://www.jonemerson.net/




Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
send mail chavakoti BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 1 September 4th, 2007 05:03 AM
How to send mail Jolley_tolson PHP How-To 0 August 13th, 2007 03:38 AM
Send E-mail meme2002bh Access ASP 2 September 30th, 2005 12:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.