Sign in to follow this  
ff8

php proplem

Recommended Posts

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 !

Share this post


Link to post
Share on other sites
It might help if you showed us sendmail.php. I'm having trouble getting to your C drive.[wink]

Share this post


Link to post
Share on other sites

.....
$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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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???

Share this post


Link to post
Share on other sites
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 :(:(:(:(

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
ff8, in a SMTP server, use per example of your providor, like> "smtp.net.com". I don't recommend to using mail function from personal computer. Use a professional host.

The program stops approx. in the 30rd email, because the time out.
In the beginning of the code, after <?, put the following:
set_time_limit(0);

This will allow your script to stop only after it finishs all the loops, etc.. You can set other times.., just put a value in seconds., ex: set_time_limit(600);

Using 0 (zero) allow the script to executes without time limit - infinite.

[Edited by - Maquiavel on August 17, 2004 12:23:14 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this