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 = me@localhost.com

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 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","turemitente@gmail.com");

 

$too = "xxxxx@yahoo.com" ;//pon tu correo para probar, your email

$subject = "TEST" ;

$message = "User message" ;

$user_email = "xxxxxxxxxxx@gmail.com" ; // 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

Edited by inyhir
Link to comment
Share on other sites

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","turemitente@gmail.com");

 

$too = "xxxxx@yahoo.com" ;//pon tu correo para probar, your email

$subject = "TEST" ;

$message = "User message" ;

$user_email = "xxxxxxxxxxx@gmail.com" ; // 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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.