Jump to content

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);

Link to comment
https://forums.phpfreaks.com/topic/3890-setting-phpini-to-use-mail/
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
[!--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
[!--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?
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.....
[!--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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.