Jump to content


Photo

setting php.ini to use mail()


  • Please log in to reply
5 replies to this topic

#1 pnutUUM

pnutUUM
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 02 March 2006 - 07:33 AM

i've tried the code as below, but there's an error,saying
"Warning: 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:\program files\easyphp1-7\www\project\frgtpswd.php on line 27.i have no idea to set the php.ini...please help me..

$email = "whoever@yourmailing.com";
$subject = "Subject!";
$body = "whatever you want to email";
$from = "From: Emailers Name <email@address.com>";
mail($email,$subject,$body,$from);



#2 grim1208

grim1208
  • Members
  • PipPipPip
  • Advanced Member
  • 89 posts

Posted 02 March 2006 - 04:37 PM

Have you tested this online through your ftp or is this a local host error? What are you using for local host? Apache or IIES

I ask this because I setup dozens of mail() source code, and I can't get it to work locally, it might be something with php.ini but I think it's just wether or not th feature comes with the localhost. (probably wrong :P) But when I test this online (just have the email go to me during testing) it works perfect on all the servers I have ever put it on.

Let me know, also I have a little better script I could give you for the email.

Let me know
grim1208
New Web Projects

#3 pnutUUM

pnutUUM
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 03 March 2006 - 12:27 AM

[!--quoteo(post=351009:date=Mar 2 2006, 11:37 AM:name=grim1208)--][div class=\'quotetop\']QUOTE(grim1208 @ Mar 2 2006, 11:37 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Have you tested this online through your ftp or is this a local host error? What are you using for local host? Apache or IIES

I ask this because I setup dozens of mail() source code, and I can't get it to work locally, it might be something with php.ini but I think it's just wether or not th feature comes with the localhost. (probably wrong :P) But when I test this online (just have the email go to me during testing) it works perfect on all the servers I have ever put it on.

Let me know, also I have a little better script I could give you for the email.

Let me know
[/quote]
thanks for your attention...i'm so glad that someone has replied me...hehehe...
i used the coding in the localhost..using apache...
so,i think that was the problem...
so, i'll try using it online and i'll tell u later if it works...
regards,
shafinah

#4 pnutUUM

pnutUUM
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 03 March 2006 - 11:52 AM

[!--quoteo(post=351009:date=Mar 2 2006, 11:37 AM:name=grim1208)--][div class=\'quotetop\']QUOTE(grim1208 @ Mar 2 2006, 11:37 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Have you tested this online through your ftp or is this a local host error? What are you using for local host? Apache or IIES

I ask this because I setup dozens of mail() source code, and I can't get it to work locally, it might be something with php.ini but I think it's just wether or not th feature comes with the localhost. (probably wrong :P) But when I test this online (just have the email go to me during testing) it works perfect on all the servers I have ever put it on.

Let me know, also I have a little better script I could give you for the email.

Let me know
[/quote]
sadly telling you that the coding does nt work even when i used online...i don't know what to do...can u help me?

#5 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 03 March 2006 - 01:30 PM

The error on your local machine is down to a configuration setting...

Open your php.ini file and find the setting 'SMTP =' (its probably set equal to localhost.

Now you need to change this setting to teh smtp of your own internet provided. I am with telewest so mine is

SMTP = smtp.blueyonder.co.uk

your will be different I imagine.

If you have outlook or outlookexpress as your email app on you pc you can find the smtp you us in there....

TOOLS > e-mail accounts > view or change... > change. You shoidl then see a form and on the right hand side you will see 'Outgoing mail server' it is the text in that box you need to copy adn paste into your php.ini file.


Oh and when you try it on-line again tell us what erros you are getting.....
follow me on twitter @PHPsycho

#6 grim1208

grim1208
  • Members
  • PipPipPip
  • Advanced Member
  • 89 posts

Posted 04 March 2006 - 03:01 AM

[!--quoteo(post=351309:date=Mar 3 2006, 09:30 AM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Mar 3 2006, 09:30 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
The error on your local machine is down to a configuration setting...

Open your php.ini file and find the setting 'SMTP =' (its probably set equal to localhost.

Now you need to change this setting to teh smtp of your own internet provided. I am with telewest so mine is

SMTP = smtp.blueyonder.co.uk

your will be different I imagine.

If you have outlook or outlookexpress as your email app on you pc you can find the smtp you us in there....

TOOLS > e-mail accounts > view or change... > change. You shoidl then see a form and on the right hand side you will see 'Outgoing mail server' it is the text in that box you need to copy adn paste into your php.ini file.
Oh and when you try it on-line again tell us what erros you are getting.....
[/quote]
Now I know I can fix the localhost problem, thanks.

And yes please tell us the online error message.
grim1208
New Web Projects




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users