bobleny Posted April 12, 2007 Share Posted April 12, 2007 How can I detect SMTP? I have a php script that wont send out an email, no errors, so I think the SMTP is disabled? I'm not sure how that part works. This script isn't for me, and I don't know if there server will have the capabilities to send php email. So, before I tell php to send the email, I want to see if it can send an email. So I have a few questions: 1.) How can I detect SMTP settings? 2.) How do I enable or install SMTP? 3.) Is there a way to turn SMTP on from a PHP script? Link to comment https://forums.phpfreaks.com/topic/46740-how-can-i-detect-smtp/ Share on other sites More sharing options...
trq Posted April 12, 2007 Share Posted April 12, 2007 1) ini_get. 2) SMTP needs a mailserver. They are not a simple matter to install. However most isp's provide one you can use with your account. 3) See 2. Also, look at ini_set. Link to comment https://forums.phpfreaks.com/topic/46740-how-can-i-detect-smtp/#findComment-227752 Share on other sites More sharing options...
bobleny Posted April 12, 2007 Author Share Posted April 12, 2007 So I would check it like this? I don't know what to look for. ini_get('SMTP') Link to comment https://forums.phpfreaks.com/topic/46740-how-can-i-detect-smtp/#findComment-227757 Share on other sites More sharing options...
trq Posted April 12, 2007 Share Posted April 12, 2007 Did you read anything in the link I provided? Link to comment https://forums.phpfreaks.com/topic/46740-how-can-i-detect-smtp/#findComment-227762 Share on other sites More sharing options...
bobleny Posted April 12, 2007 Author Share Posted April 12, 2007 Yes I did, and I see nothing about SMTP. I know how to use the ini_get(). I don't know what to put in the "()". Link to comment https://forums.phpfreaks.com/topic/46740-how-can-i-detect-smtp/#findComment-227766 Share on other sites More sharing options...
bobleny Posted April 12, 2007 Author Share Posted April 12, 2007 Here, I made this and it doesn't work... I don't know what my ini file calls the SMTP thingy.... <?php if (ini_get('SMTP') == TRUE && $set == "1") { $to = "[email protected]"; $subject = "Test"; $message = "This is a test message!"; if (mail($to, $subject, $message)) { echo "Sent"; } else { echo "Error!"; } } else { echo "Disabled"; } ?> Link to comment https://forums.phpfreaks.com/topic/46740-how-can-i-detect-smtp/#findComment-227779 Share on other sites More sharing options...
trq Posted April 12, 2007 Share Posted April 12, 2007 echo ini_get("SMTP"); Will show you your current smtp settings. There is an appendix here that shows what can be set / seen from ini_set / ini_get. Link to comment https://forums.phpfreaks.com/topic/46740-how-can-i-detect-smtp/#findComment-227780 Share on other sites More sharing options...
trq Posted April 12, 2007 Share Posted April 12, 2007 If ini_get displays localhost (default) you will need a webserver on your machine. Otherwise, you'll need to change the ini setting to reflect the mail server your isp or host provide you. You really don't want to setup a mailserver unless you know what your doing. Link to comment https://forums.phpfreaks.com/topic/46740-how-can-i-detect-smtp/#findComment-227782 Share on other sites More sharing options...
bobleny Posted April 12, 2007 Author Share Posted April 12, 2007 How do I find out what the mail server address of my ISP is? Link to comment https://forums.phpfreaks.com/topic/46740-how-can-i-detect-smtp/#findComment-227958 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.