Jump to content

How to use email with Apache and PHP on localhost

VinnyPet's Photo
Posted Jun 15 2012 06:48 AM
9991 Views

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\Apache Software Foundation\Apache2.2\htdocs\PHPThreeFinal\sendemail.php on line 24

This is the message I get using the program example in Chapter 3 (PHP & MySql). I have tried a few SMTP and smtp_port settings, nothing is working. I am using PHP 5.2.17 and Apache 2.2.22.

HELP

Tags:
2 Subscribe


1 Reply

0
  macnlos's Photo
Posted Jul 02 2012 11:05 AM

It all boils down to whether or not your have SMTP running on your localhost. From the looks of the errors, you don't. From the looks of the question I would not assume you would be able to set it up (I'm not being negative or condescending, I'm just answering the question).

If I were you I would use an SMTP server that you already have setup. You have email and you are a getting it from some provide (ISP, gMail, etc). That means you have an email address and account to use that SMTP server for sending your personal mail.

Here is an external link, may not be the best but it's a start, on how to configure PHP (php.ini) to use an external/remote SMTP server:

http://email.about.c...ending_Mail.htm

Good luck!
CR
=========================
Sent to you from my
iPad, iPhone, BlackBerry,
Laptop, Desktop, or
Kitchen Toaster