Jump to content

Archived

This topic is now archived and is closed to further replies.

pnutUUM

setting php.ini to use mail()

Recommended Posts

i've tried the code as below, but there's an error,saying
[b]"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[/b].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);

Share this post


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

Share this post


Link to post
Share on other sites
[!--quoteo(post=351009:date=Mar 2 2006, 11:37 AM:name=grim1208)--][div class=\'quotetop\']QUOTE(grim1208 @ Mar 2 2006, 11:37 AM) [snapback]351009[/snapback][/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

Share this post


Link to post
Share on other sites
[!--quoteo(post=351009:date=Mar 2 2006, 11:37 AM:name=grim1208)--][div class=\'quotetop\']QUOTE(grim1208 @ Mar 2 2006, 11:37 AM) [snapback]351009[/snapback][/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?

Share this post


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

Share this post


Link to post
Share on other sites
[!--quoteo(post=351309:date=Mar 3 2006, 09:30 AM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Mar 3 2006, 09:30 AM) [snapback]351309[/snapback][/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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.