0

Hello, I am trying to include a Contact Form in my website.
I'm using WAMPserver and Free SMTP Server to test it.

The problem is, everytime I click in my button of Send Mail, this error appears in my browser:

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\MyWebsite\site\Contact.php on line 16

By the other side, in the Free SMTP Server the status is "Waiting for connections on port #25; using DNS server: 127.0.0.1"

In the php.ini file, I have this:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = myMail@hotmail.com

()

Here is the PHP code that I'm using:

<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['textarea'];

$mail_to = 'myMail@hotmail.com';
$subject = 'Mensaje enviado desde la página'.$field_name;

$body_message = 'De: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Mensaje: '.$field_message;

$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";

$mail_status = mail($mail_to, $subject, $body_message, $headers);

if ($mail_status) { ?>
    <script language="javascript" type="text/javascript">
        alert('Gracias! Tu mensaje he sido enviado. Nos contactaremos contigo lo más pronto posible.');
        window.location = 'Contacts.html';
    </script>
<?php
}
else { ?>
    <script language="javascript" type="text/javascript">
        alert('Error al enviar. Por favor intenta de nuevo');
        window.location = 'Contacts.html';
    </script>
<?php
}
?>

I think that's all the info I got, I would really appreciate any kind of help!
Thanks!!

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.