php proplem

Started by
11 comments, last by ff8 19 years, 8 months ago
hi all i make a small server for me and i make it support php i make listmail script and i use mail() function i face this problem ?? Warning: Failed to Connect in C:\apache\htdocs\listmail_new\admin\sendmail.php on line 9 #has been sent to srmo_13@hotmail.com why?? bye !
Advertisement
It might help if you showed us sendmail.php. I'm having trouble getting to your C drive.[wink]
.....        $from="FROM: <".$from2.">";        while($row=mysql_fetch_array($r)){            mail($row['mail'],$sub,$body,$from);            echo"#has been sent to ".$row['mail']."<BR>";        }.....


do you think from the code :S?
i test it before i another server and it's work allright
You're trying to use "mail()" in your computer?
Open your "php.ini" and find "[mail function]"
Change the line:
SMTP = localhost
putting a valid SMTP server.

Save and restart the server.
Alfred Reinold Baudisch[Game Development Student] [MAC lover] [Ruby, Ruby on Rails and PHP developer] [Twitter]
Use if to validate the send, like:
.....        $from="FROM: <".$from2.">";        while($row=mysql_fetch_array($r)){            if(@mail($row['mail'],$sub,$body,$from))              echo "#has been sent to ".$row['mail']."<BR>";            else               echo "#error while sending to ".$row['mail']."<BR>";                     }.....



The "@" in front of the function will not print PHP errors messages.
Alfred Reinold Baudisch[Game Development Student] [MAC lover] [Ruby, Ruby on Rails and PHP developer] [Twitter]
thanks for your answer :):):)
but what you mean from
"SMTP = localhost
putting a valid SMTP server"
i open php.ini and find this line
SMTP = localhost
change it to what???
hello the problem gone but i dont know why when i try to send the loop stop just in 30 email and it can not send email :(:(:(:(
Quote:Original post by ff8
thanks for your answer :):):)
but what you mean from
"SMTP = localhost
putting a valid SMTP server"
i open php.ini and find this line
SMTP = localhost
change it to what???


Change it to an SMTP server address. An SMTP server is an email sending server (as opposed to, say, a POP3 server which is used to collect messages). Unless you have an email server on localhost, you're not going to get very far.
How is your site hosted?
For example, I'm hosted on ActiveISP, and my POP3 is popmail.activeisp.com and my SMTP is smtpmail.activeisp.com
Check your hosting; see if they mention anything.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

i am using my pc as host for me ,.. i opend 25 port from my dsl router from Virtual server for my ip 192.168.8.2 i change the stmp server from localhost to 192.168.8.2 but the same thing (i change it in php.ini)
i wonder why?
You need a SMTP server program?

This topic is closed to new replies.

Advertisement