I have been trying to do tests to send an email in local through a form with php
, but it does not work for me. He returns the following message:
Error sending the email
.
That is, the value of the Boolean $enviado
is false
. I do not understand why he does not send the email. I do not want to have to mount a server smtp
.
In the php.ini I had the following:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP=localhost
; http://php.net/smtp-port
smtp_port=25
And it still does not work, I changed the values according to link and it still does not work:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP=smtp.wlink.com.np
; http://php.net/smtp-port
smtp_port=25
I use Apache , XAMPP for Windows 10 with the development environment Netbeans 8.2
Let's see if anyone can help me, thanks in advance.
Greetings.
* This is the code I refer to that does not send me the emails:
<?php
$para = '[email protected]';
$titulo = 'Enviando email desde PHP';
$mensaje = '<html>' .
'<head><title>Email con HTML</title></head>' .
'<body><h1>Email con HTML</h1>' .
'Esto es un email que se envía en el formato HTML' .
'<hr>' .
'Enviado por mi programa en PHP' .
'</body>' .
'</html>';
$cabeceras = 'MIME-Version: 1.0' . "\r\n";
$cabeceras .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$cabeceras .= 'De: Nombre Apellido <[email protected]>';
$enviado = mail($para, $titulo, $mensaje, $cabeceras);
if ($enviado)
echo 'Email enviado correctamente';
else
echo 'Error en el envío del email';
?>