email desde localhost
Publicado por siREZ (203 intervenciones) el 10/04/2014 21:43:26
Cordial saludo.
deseo enviar un email desde localhost instalado en una USB.
utilizo el siguiente codigo:
al enviar me marca el siguiente error:
he realizado el cambio en php.ini así:
codigo original:
por el siguiente:
me marca el mismo error.
Alguien me puede ayudar con esto?
gracias.
siREZ
deseo enviar un email desde localhost instalado en una USB.
utilizo el siguiente codigo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php session_start();
function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
$file = $path.$filename;
$file_size = filesize($file);
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$uid = md5(uniqid(time()));
$name = basename($file);
$header = "From: ".$from_name." <".$from_mail.">\r\n";
$header .= "Reply-To: ".$replyto."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use different content types here
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
$header .= $content."\r\n\r\n";
$header .= "--".$uid."--";
if (mail($mailto, $subject, "", $header)) {
echo "mail send ... OK"; exit;// or use booleans here
} else {
echo "mail send ... ERROR!";exit;
}
}
$my_file = "serial.txt"; // puede ser cualquier formato
$my_path = $_SERVER['DOCUMENT_ROOT']."/rips para enviar/";
$my_name = $_SESSION['usuario'];
$my_mail = "gerencia@anamnesis.com.co";
$my_replyto = "gerencia@anamnesis.com.co";
$my_subject = "Le adjuntamos mis RIPS";
$my_message = "Tu mensaje..<br>este es el espacio....<br><br>para el mensaje";
mail_attachment($my_file, $my_path, "casilla_destinatario@dominio.com", $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
?>
al enviar me marca el siguiente error:
1
2
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 E:\root\Pacientes\enviar email.php on line 28
mail send ... ERROR!
he realizado el cambio en php.ini así:
codigo original:
1
2
3
4
5
6
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
por el siguiente:
1
2
3
4
5
6
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = 127.0.0.1
; http://php.net/smtp-port
smtp_port = 25
me marca el mismo error.
Alguien me puede ayudar con esto?
gracias.
siREZ
Valora esta pregunta


0