Skip to content Skip to sidebar Skip to footer

Unable To Send Mail Via Php Mail()

I am unable to send an email via php's mail function. This is the error I receive. Warning: mail() [function.mail]: Failed to connect to mailserver at 'localhost' port 25, verify y

Solution 1:

If you want to use built-in mail(), you will need to talk to the server administrator. It is possible to use an external SMTP server on Windows, but it has to be specified in the php.ini settings, and PHP's built-in functions don't support SMTP authentication.

The usual way is to either use a local mail server that in turn can talk to a "real" SMTP server with authentication, or use a mailing package like SwiftMailer that can connect to a 3rd party SMTP server like GMail directly.

Solution 2:

You need to have a mail server to send mails. If you only have apache, you cannot, unless you edit the php.ini file and set the smpt_server to one that allows you to do so. Note that this will only work depending on your ISP.

If you have a hosting account you can upload the files and online they will work.

Solution 3:

You should run your own mailserver on your server. Most likely it's not started or not installed.

As I can see your are running it on windows it's most likely the later. You could try using your providers mail server. Or googles. But you need most likely a username and password for that.

Solution 4:

you should avoid using php's mail()-function as ist connects and disconnects to the mailserver for every mail sent.

instead of that, try to use something like phpMailer wich allows easy configuration and sending a lot of mails without performance-problems.

Solution 5:

If you want to run your own mail server (if this is a development environment for example) you could use mercury.

Post a Comment for "Unable To Send Mail Via Php Mail()"