Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP 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:43 PM
Authorized User
 
Join Date: Feb 2006
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with sending mail in 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 13th, 2006, 03:13 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you set up your SMTP settings in php.ini? By default it assumes you have sendmail running on your local system. Do you? If not, you can configure it to point somewhere else (perhaps your ISP).

More info here: http://us3.php.net/manual/en/ref.mail.php

Jon Emerson
http://www.jonemerson.net/
 
Old July 13th, 2006, 10:50 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Hi Jon,

Thanks, that was definitely a much better answer than mine! Looks like I can test this function on my home server now too.

Mike

Mike
EchoVue.com
 
Old July 13th, 2006, 10:52 AM
Authorized User
 
Join Date: Feb 2006
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I read this article , but i don't know where i can find the sendmail_path - the directory mentioned there is unix directory - but on my windows xp i can't find it.

 
Old July 16th, 2006, 03:38 PM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Paula,

You don't need to set sendmail_path. (In fact, if you set it to anything, it probably will not work on Windows.) Instead just set SMTP, smtp_port, and sendmail_from.

Jon Emerson
http://www.devexplore.com/developer/...jects.php?id=6





Similar Threads
Thread Thread Starter Forum Replies Last Post
mail sending in php lakshmi_annayappa BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 July 24th, 2008 09:15 AM
sending mail through php rkzico PHP How-To 1 November 8th, 2007 10:03 AM
problem with sending e-mail Paula222 Pro PHP 1 July 27th, 2006 06:57 AM
Sending mail problem!!!! NitinJoshi General .NET 2 January 13th, 2005 08:31 AM
Problem with sending mail nikunjn VS.NET 2002/2003 1 January 29th, 2004 08:29 AM





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