ballhogjoni Posted November 5, 2008 Share Posted November 5, 2008 I am looking at the php info page and would like to know if the mail() is enabled. How would I go about checking that other than trying to send an email out? Link to comment https://forums.phpfreaks.com/topic/131515-how-can-i-tell-if-the-mail-is-enabled/ Share on other sites More sharing options...
Mchl Posted November 5, 2008 Share Posted November 5, 2008 echo extension_loaded('mail') ? "mail" : "no mail"; Link to comment https://forums.phpfreaks.com/topic/131515-how-can-i-tell-if-the-mail-is-enabled/#findComment-683053 Share on other sites More sharing options...
rhodesa Posted November 5, 2008 Share Posted November 5, 2008 that just means the extension is installed, that doesn't mean it's configured to work properly.... easiest thing is to just send yourself an email with it...if that does work, what OS is this on? Link to comment https://forums.phpfreaks.com/topic/131515-how-can-i-tell-if-the-mail-is-enabled/#findComment-683057 Share on other sites More sharing options...
Mchl Posted November 5, 2008 Share Posted November 5, 2008 But it sure tell if it's enabled. That was the question Actually I'd send mail to myself as well. Link to comment https://forums.phpfreaks.com/topic/131515-how-can-i-tell-if-the-mail-is-enabled/#findComment-683062 Share on other sites More sharing options...
PFMaBiSmAd Posted November 5, 2008 Share Posted November 5, 2008 Since mail is not an external extension, that line of code always returns "no mail" anyway. Give it a try. What exactly is the question? The mail() function could be disabled by the host, in which case I believe function_exists() might or might not tell you. If you are checking if there is a mail server, your best bet would be to read the SMTP and port settings, and attempt to open a socket connection to the mail server. Link to comment https://forums.phpfreaks.com/topic/131515-how-can-i-tell-if-the-mail-is-enabled/#findComment-683074 Share on other sites More sharing options...
Mchl Posted November 5, 2008 Share Posted November 5, 2008 Since mail is not an external extension, that line of code always returns "no mail" anyway. Give it a try. It's not? My bad. Link to comment https://forums.phpfreaks.com/topic/131515-how-can-i-tell-if-the-mail-is-enabled/#findComment-683081 Share on other sites More sharing options...
PFMaBiSmAd Posted November 5, 2008 Share Posted November 5, 2008 Installation There is no installation needed to use these functions; they are part of the PHP core. Link to comment https://forums.phpfreaks.com/topic/131515-how-can-i-tell-if-the-mail-is-enabled/#findComment-683083 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.