-5

I am using a mail() function to send mail in PHP from localhost but it is not working.

Sending mail from localhost is my primary concern. Please guide me a way to achieve the same.

halfer
  • 19,824
  • 17
  • 99
  • 186
Dipika Awasthi
  • 11
  • 1
  • 1
  • 4

2 Answers2

0

You won't have SMTP server installed by default so you can't send emails from localhost directly. Either you can set up SMTP server on local or use third party SMTP servers. Have a look at

http://www.mittalpatel.co.in/php_send_mail_from_localhost_using_gmail_smtp

which gives you insight about how to send mail from localhost using third party SMTP server.

Here's the some of the method that might be help you :

Method 1 https://stackoverflow.com/a/16814318/2377343

Method 2 http://thephpcode.blogspot.com/2009/03/setting-up-local-mail-smtp-pop3-imap.html

Method 3 http://blog.techwheels.net/send-email-from-localhost-wamp-server-using-sendmail/

Method 4 Configure wamp server to send email

Method 5 http://roshanbh.com.np/2007/12/sending-e-mail-from-localhost-in-php-in-windows-environment.html

Community
  • 1
  • 1
Hardy Mathew
  • 684
  • 1
  • 6
  • 22
0

It is configured to use localhost:25 for the mail server.

The error message says that it can't connect to localhost:25.

Therefore you have two options:

  1. Install / Properly configure an SMTP server on localhost port 25
  2. Change the configuration to point to some other SMTP server that you can connect to
Ahmed Ziani
  • 1,206
  • 3
  • 14
  • 26