Jump to content

PHP and localhost


The Praetorian

Recommended Posts

I'm testing my website on my localhost, and I have a few email forms on my website. I'm wondering if anyone knows if I can configure my localhost (or php) to email stuff to myself...(From my localhost to say... Outlook express). Mainly because I want to see what it's going to output as. Or if the email function will even work with my script.So. Anyone have any ideas? I'm using xampp.

Link to comment
Share on other sites

Well, no, not really. I already have an email form. What I'm wondering, is if it's possible to send myself email from that form even if it's hosted on my localhost and not on my server. (I want to test out to make sure I have the line tabs and everything right [the part that someone sees when they actually get the email]) and I was just wondering if there's any other way to do that than uploading the form to my web server.

Link to comment
Share on other sites

Well, no, not really. I already have an email form. What I'm wondering, is if it's possible to send myself email from that form even if it's hosted on my localhost and not on my server. (I want to test out to make sure I have the line tabs and everything right [the part that someone sees when they actually get the email]) and I was just wondering if there's any other way to do that than uploading the form to my web server.
Your so called "localhost" is actually your web server. Anything you can do on a host, you can do there, and even more actually, scince you have full control over your own computer. If you type your own IP adress instead of localhost from your computer or any other, you'll see you again have access to the server.
Link to comment
Share on other sites

Yes, but is it possible to configure my computer to send mail to myself? Whenever I try to send the form I get this error.Warning: mail() [function.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\xampp\htdocs\mail.php on line 15So to send mail to myself would I just go into php.ini and change localhost to my ip address?

Link to comment
Share on other sites

Yes, but is it possible to configure my computer to send mail to myself? Whenever I try to send the form I get this error.Warning: mail() [function.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\xampp\htdocs\mail.php on line 15So to send mail to myself would I just go into php.ini and change localhost to my ip address?
PHP is separate from a mail server. If you want to receive an email, you'll need to install and configure a mail server on your PC. I think XAMPP has Mercury mail as one such server, but I have no idea how to configure it.As for sending a mail with your computer to any other computer as the mail server (that is, to send a mail from your computer to email@yahoo.com for example) I thought you could do that with the mail() function with no problem. Perhaps I was wrong and there's something more to it. I don't know.
Link to comment
Share on other sites

Yeah, the mail function needs to connect to a mail server. Whenever mail is sent or received, it goes through a server. The settings for which mail server the mail function should use are in php.ini. You can specify any SMTP server you want, and you probably want to leave the port to the default 25. You should be able to check in a mail client like Outlook to figure out which SMTP server it is using, and use the same server for PHP. But that should only be for testing, in a live environment you would probably want to use an SMTP server that is installed locally on the web server.

Link to comment
Share on other sites

  • 3 weeks later...
Yeah, the mail function needs to connect to a mail server. Whenever mail is sent or received, it goes through a server. The settings for which mail server the mail function should use are in php.ini. You can specify any SMTP server you want, and you probably want to leave the port to the default 25. You should be able to check in a mail client like Outlook to figure out which SMTP server it is using, and use the same server for PHP. But that should only be for testing, in a live environment you would probably want to use an SMTP server that is installed locally on the web server.
Actually i had the same problem and i tried to configure php.ini by setting SMTP = smtp.gmail.com and port 25 but nothing has happened.I did not use an SMTP server as i believed that i could use the gmail's server by configuring properly the php.ini. Am i in the right way or not ?
Link to comment
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
×
×
  • Create New...