Page 1 of 1

Mail()

Posted: Mon Mar 14, 2005 4:57 am
by dave_c00
Hi,

If i want to use mail() on a web page do i need any extra stuff on my the server other than normal php.

Thanks

Dave

Posted: Mon Mar 14, 2005 5:09 am
by n00b Saibot
check section REQUIREMENTS on this page Mail function

Posted: Mon Mar 14, 2005 5:31 am
by Chris Corbyn
The only thing you need is to have sendmail enabled in php.ini and sendmail_from defined and SMTP defined in php.ini.

If all that's set up then you should have no trouble, there's certainly no components to install with PHP 4+.

Mail()

Posted: Wed Mar 23, 2005 3:24 am
by dave_c00
Thanks for the replies,

I do not host the site, so what do i need to ask my server company to do?

Thanks

Dave

Posted: Wed Mar 23, 2005 4:07 am
by Chris Corbyn
Have you tried using the mail() function. You didn't mention if you were getting errors and what they are.

Some hosts have the mail() function disabled for obvious reasons... If this is not the case they need to set the SMTP, and the SMTP PORT NUMBER (I can't remember the exact name for it) setting. If you have any error's and that's why you're asking please post them since it may be unrelated to the host :D

Posted: Thu Mar 24, 2005 4:09 am
by dave_c00
I have the mail function amongst some other php scripting and when executed nothing happens. no error message or anything. The code is as follows;

Code: Select all

<?php
$to = "dave_c00@hotmail.com";
$subject = "New Order";
$message = "Testing";
mail($to,$subject,$message) or print "Could not send mail";
?>
Thanks

Dave


feyd | Please review how to post code using

Code: Select all

and

Code: Select all

tags. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Thu Mar 24, 2005 4:44 am
by Chris Corbyn
Put:

Code: Select all

error_reporting(E_ALL);
at the top of your code and well see what happens ;-)

Run...

Code: Select all

phpinfo();
Look for disabled functions and see if it's disabled.

Posted: Thu Mar 24, 2005 10:26 am
by timvw
these days i prefer to start debugging with:

Code: Select all

ini_set('error_reporting', E_ALL); // same as error_reporting(E_ALL);
ini_set('display_errors', TRUE); // don't know the equivalent, so it's easier to remember 2 times ini_set