Failed to connect to mailserver at localhost port 25
You need to be running a mail server locally.
If this is Unix, enable sendmail
If this is Windows install the Simple Mail Transfer Server (not sure if the name is correct) component of IIs. E.g. for windows 2003 follow this: http://msdn.microsoft.com/en-us/library/8b83ac7t.aspx
Failed to connect to mailserver at localhost port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set()
If you are running your application just on localhost and it is not yet live, I believe it is very difficult to send mail using this.
Once you put your application online, I believe that this problem should be automatically solved.
By the way,ini_set() helps you to change the values in php.ini during run time.
This is the same question as Failed to connect to mailserver at "localhost" port 25
also check this php mail function not working
Warning: mail() [function.mail]: Failed to connect to mailserver at localhost port 25
Looks like your server doesn't have a smtp mailserver running. You could use these functions to set a different smtp server:
ini_set('SMTP', "server.com");
ini_set('smtp_port', "25");
ini_set('sendmail_from', "email@domain.com");
Of course you must know an active smtp server.
Good luck!
mail(): Failed to connect to mailserver at localhost port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set()
This config helped me to solve my issue
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'smtp.gmail.com',
'smtp_port' => 465,
'smtp_crypto' => 'ssl',
'smtp_timeout' => '30',
'smtp_user' => 'xyz@gmail.com', // your smtp user
'smtp_pass' => 'xyzxyz', // your smtp password
'wordwrap' => TRUE
);
I changed the SMTP and SMTP Port but it still says Failed to connect to mailserver at localhost port 25
I got the solution to my own question. The problem was:
At first I was changing the php.ini
file from C:\xampp\php\
But, when I did
echo phpinfo();
die();
I found the loaded configuration file
was:
C:\xampp\apache\bin\php.ini
So, I changed
SMTP = localhost
smtp_port = 25
to
SMTP = smtp.wlink.com.np
smtp_port = 25
And it worked!
Failed to connect to mailserver at localhost port 25, verify your SMTP
"nyu.smtp.edu" doesn't look right. Try "smtp.nyu.edu". You might go back to using port 25.
Related Topics
Modify Array Values in Foreach Loop
How to Remove Multiple Utf-8 Bom Sequences
How to Pad Single-Digit Numbers With a Leading 0
PHP Array Delete by Value (Not Key)
Filter Array by Its Keys Using an Array of Allowed Keys
Delimiter Must Not Be Alphanumeric or Backslash and Preg_Match
How to Change From-address When Using Gmail Smtp Server
I Have 2 Dates in PHP, How to Run a Foreach Loop to Go Through All of Those Days
PHP File_Get_Contents() and Setting Request Headers
PHP Foreach Change Original Array Values
How to Evaluate Formula Passed as String in PHP
How to View Query Error in Pdo PHP
When Should I Use MySQLi Instead of MySQL