Jump to content

Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and


cluce

Recommended Posts

I am trying to send an email through a web form but I am getting an error......

I am trying to use windows xp on my local machine.

 

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:\wamp\www\sendmail.php on line 19

 

Can someone tell me how to fix this.

Here are my config settings for the mail server.....

 

[mail function]

; For Win32 only.

SMTP = localhost

smtp_port = 25

 

; For Win32 only.

;sendmail_from = [email protected]

 

 

well I am doing all my testing on the local machine using a localhost. My company email is @reaganpower.com but I am not using their email server for testing, I will only use my work email to recieve the message after submitted. So I am not sure if I am supposed to use my work email b/c I am not using their email server for testing that is all done on my local machine.

no use who ever provides your internet connection at home...

 

they will have a mail server that you should use for outgoing messages.

 

reply with your service provider and i will go look for the server you need

 

To know whats the real fact you need to run the SMTP Commands in port 25 of that domain. to do it easily You can use this

<?php
$mail = new mail("admin@localhost", "Subject", "Mail Body");
//Just add a Simple hack here to show the SMTP conversation
$mail->show_cnv = true;
//3 Arguments Are Given
//$mail = new mail("to@domain", "Mail Subject", "Mail Body");
if($mail->send())
    {
        echo "Mail Sent Succfully\n";
    }
else 
    {
        echo "Sorry Mail Sending Failed\n";
        print_r($mail->error);//Print The Errors
    }
?>

You will find the mail class here

http://zigmoyd.sourceforge.net/man/mail.php

PLease dont use the current version use the Previous version.

But please see the Installetion and Instruction on this Page http://zigmoyd.sourceforge.net/man/index.php

 

And if you dont wanna use this class use it for first time and see teh commands it sends and send those commands Manualy.

  • 5 years later...

Holaaa!! a mi me salia el mismo error con WAMPSERVER y lo soluciones con el SQ SMTP Server 3,... tal como sale en el siguiente link:

 

http://www.emagister.com/curso-apache-php-mysql-phpmyadmin-como-modulo-apache/instalacion-servidor-correo-smtp

 

 

el correo me lo mando a SPAM. shocked.gif ... download SQ SMTP

 

y siguiendo este codigo:

 

<?php

ini_set("SMTP","localhost");//Cambien mail.cantv.net Por localhost ... ojo, ojo OJO

ini_set("smtp_port",25);

ini_set("sendmail_from","[email protected]");

 

$too = "[email protected]" ;//pon tu correo para probar, your email

$subject = "TEST" ;

$message = "User message" ;

$user_email = "[email protected]" ; // valid POST email address

 

$headers = "From: $user_email " ;

$headers .= "Reply-To: $too " ;

$headers .= "Return-Path: $too " ;

$headers .= "X-Mailer: PHP/" . phpversion (). " " ;

$headers .= 'MIME-Version: 1.0' . " " ;

$headers .= 'Content-type: text/html; UTF-8' . " " ;

 

if( mail ( $too , $subject , $message , $headers )) echo 'SENT' ;

 

?>

 

 

My php.ini is:

 

 

; http://php.net/smtp

SMTP = localhost

; http://php.net/smtp-port

smtp_port = 25

Holaaa!! a mi me salia el mismo error con WAMPSERVER y lo soluciones con el SQ SMTP Server 3,... tal como sale en el siguiente link:

 

http://www.emagister...dor-correo-smtp

 

 

el correo me lo mando a SPAM. shocked.gif ... download SQ SMTP

 

y siguiendo este codigo:

 

<?php

ini_set("SMTP","localhost");//Cambien mail.cantv.net Por localhost ... ojo, ojo OJO

ini_set("smtp_port",25);

ini_set("sendmail_from","[email protected]");

 

$too = "[email protected]" ;//pon tu correo para probar, your email

$subject = "TEST" ;

$message = "User message" ;

$user_email = "[email protected]" ; // valid POST email address

 

$headers = "From: $user_email " ;

$headers .= "Reply-To: $too " ;

$headers .= "Return-Path: $too " ;

$headers .= "X-Mailer: PHP/" . phpversion (). " " ;

$headers .= 'MIME-Version: 1.0' . " " ;

$headers .= 'Content-type: text/html; UTF-8' . " " ;

 

if( mail ( $too , $subject , $message , $headers )) echo 'SENT' ;

 

?>

 

 

My php.ini is:

 

 

; http://php.net/smtp

SMTP = localhost

; http://php.net/smtp-port

smtp_port = 25

 

Please start a new thread in english.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.