jkkenzie Posted October 3, 2008 Share Posted October 3, 2008 Am getting this error " Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\Mail\index.php on line 40" with the code below to send mail using my local intranet machine. <?php /* Setup your Subject and Message Body */ $subject='Testing PHP Email'; $body='Put Your Text Message Here.'; /* Specify your smtp Server, Port and Valid From Address */ ini_set('smtp','localhost'); ini_set('smtp_port',25); ini_set('sendmail_from','[email protected]'); /* Additional Headers */ $headers = 'Cc:Real CC Name <[email protected]>'."\r\n"; $headers .= 'Bcc:Real BCC Name <[email protected]>'."\r\n"; /* Try to send message and respond if it sends or fails. */ if(mail ('ToPersonsName <[email protected]>', $subject, $body, $headers )){ echo "<h2>Your Message was sent!</h2>"; } else{ echo "<font color='red'><h2>Your Message Was Not Sent!</h2></font>"; } exit; ?> Link to comment https://forums.phpfreaks.com/topic/126885-mail/ Share on other sites More sharing options...
nadeemshafi9 Posted October 3, 2008 Share Posted October 3, 2008 looks like your ini set is not making things right try it without ini set and use the defaults see if that works first Link to comment https://forums.phpfreaks.com/topic/126885-mail/#findComment-656270 Share on other sites More sharing options...
jkkenzie Posted October 3, 2008 Author Share Posted October 3, 2008 I was not using ini_set() before, i was using the defaults and it was giving me the same errors, that is when i decided to specify smtp and the like using ini_set(). So, it still gives the same error. Regards, Joseph Link to comment https://forums.phpfreaks.com/topic/126885-mail/#findComment-656285 Share on other sites More sharing options...
PFMaBiSmAd Posted October 3, 2008 Share Posted October 3, 2008 Do you have a mail server installed on your local computer? Link to comment https://forums.phpfreaks.com/topic/126885-mail/#findComment-656291 Share on other sites More sharing options...
nadeemshafi9 Posted October 3, 2008 Share Posted October 3, 2008 in set dosent always make the changes some things are locked, go to ur ini and change the stuff. Link to comment https://forums.phpfreaks.com/topic/126885-mail/#findComment-656369 Share on other sites More sharing options...
nadeemshafi9 Posted October 3, 2008 Share Posted October 3, 2008 stop using ini set and check ur details of ur mail, anyways u need a mail server installed u can get an all in one package to do testing on ur local machine its called xamp Link to comment https://forums.phpfreaks.com/topic/126885-mail/#findComment-656372 Share on other sites More sharing options...
ultratek Posted October 3, 2008 Share Posted October 3, 2008 thorpe posted this to me: <?php echo ini_get('SMTP'); ?> us it to get the smtp server info... i beleive you need only one line for ini_set...the other values are default... so maybe the one line might look similar to mine: <?php ini_set("SMTP","bosmail.nt.com"); ?> Link to comment https://forums.phpfreaks.com/topic/126885-mail/#findComment-656433 Share on other sites More sharing options...
jkkenzie Posted October 13, 2008 Author Share Posted October 13, 2008 Hi! guys, What is a mail server ? I have WAMP installed, how can WAMP work with XAMP? I dont the errors are with ini file, everything is set, SMTP = localhost PORT = 25, what else does it need here. The error again is here: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() Link to comment https://forums.phpfreaks.com/topic/126885-mail/#findComment-663883 Share on other sites More sharing options...
jkkenzie Posted October 13, 2008 Author Share Posted October 13, 2008 I have installed hMailServer and this is the error am getting: Warning: mail() [function.mail]: SMTP server response: 550 Delivery is not allowed to this address.in C:\wamp\www\phpOpenChat\include\class.Chatter.inc on line 1686 Link to comment https://forums.phpfreaks.com/topic/126885-mail/#findComment-663898 Share on other sites More sharing options...
nadeemshafi9 Posted October 13, 2008 Share Posted October 13, 2008 Wamp is windows apache and mysql. you have no ftp server so when ur php scvript neeeds to do an ftp you cant do it but you can use php function upload file. an ftp is a when u use and account on that computer to upload and download files its standard. you need to install xamp it will work whilst WAMP is installed but will take over ur apache , basicaly get rid of what u got install XAMP its an all in one Link to comment https://forums.phpfreaks.com/topic/126885-mail/#findComment-664471 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.