error al enviar string por correo
Publicado por Orlando (73 intervenciones) el 27/08/2016 23:05:25
Buenas tardes y gracias de antemano.
Estoy tratando de enviar unos resultados que guardo en una base de datos a un correo con diferentes articulos por ejemplo:
Producto: cebolla
Cantidad : 20
Unidad: Kg
Producto zanahoria
Cantidad: 15
Unidad: Kg
Cuando doy al boton enviar me lo guarda en lo base de datos los dos registros, pero cuando envía por correo sólo envía el ultimo registro, me dieron una manito pero ahora me esta generando un error:
A message that you sent contained a recipient address that was incorrectly
constructed:
<p>Producto: malformed address: Producto: may not follow <p>
The message has not been delivered to any recipients.
------ This is a copy of your message, including all the headers. ------
Producto zanahoria
Cantidad: 15
Unidad: Kg
Llevo 3 dias tratando de resolver este problema pero nada :(
Alguien me puede dar una mano.
Este es el error en el correo:
A message that you sent contained a recipient address that was incorrectly
constructed:
<p>Producto: malformed address: Producto: may not follow <p>
The message has not been delivered to any recipients.
------ This is a copy of your message, including all the headers. ------
Estoy tratando de enviar unos resultados que guardo en una base de datos a un correo con diferentes articulos por ejemplo:
Producto: cebolla
Cantidad : 20
Unidad: Kg
Producto zanahoria
Cantidad: 15
Unidad: Kg
Cuando doy al boton enviar me lo guarda en lo base de datos los dos registros, pero cuando envía por correo sólo envía el ultimo registro, me dieron una manito pero ahora me esta generando un error:
A message that you sent contained a recipient address that was incorrectly
constructed:
<p>Producto: malformed address: Producto: may not follow <p>
The message has not been delivered to any recipients.
------ This is a copy of your message, including all the headers. ------
Producto zanahoria
Cantidad: 15
Unidad: Kg
Llevo 3 dias tratando de resolver este problema pero nada :(
Alguien me puede dar una mano.
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
include("conexion.php");
$fecha_actual = date("Y-m-d");
$nombre = $_POST['nombre'];
$empresa = $_POST['empresa'];
$email = $_POST['email'];
$comentario = $_POST['adicionesysugerencias'];
$producto = $_POST['chk'];
$cantidad = $_POST['cantidad'];
$unidad = $_POST['unidad'];
$observacion = $_POST['obs'];
$cadena_final="";
for($i = 0; $i<sizeof($producto); $i++)
{
if ($unidad[$i] == 'lb') {
$unidad[$i] = 'kg';
$cantidad[$i] = $cantidad[$i] * .454;
}
if ($unidad[$i] == 'grs') {
$unidad[$i] = 'kg';
$cantidad[$i] = $cantidad[$i] * .001;
}
$query="INSERT INTO pedidos(fecha_actual, nombre, empresa, email, producto, cantidad, unidad, observacion, adicionesysugerencias)
VALUE ('$fecha_actual','$nombre','$empresa','$email','".$producto[$i]."','".$cantidad[$i]."','".$unidad[$i]."','".$observacion[$i]."','$comentario')";
$resultado=$conexion->query($query);
$prod = $producto[$i];
$cant = $cantidad[$i];
$uni = $unidad[$i];
$cadena_final.= '<p>Producto: <strong>'. $prod .' ' . $cant . ' '. $uni .'</strong></p>';
}
/// Envio de pedido al correo ////
//Contenido del mensaje//
$titulo = "Solicitud de pedidos online";
$contenido = '<html>
<head>
<title>' . $titulo . '</title>
</head>
<body>
<h1>Haz recibido un nuevo pedido</h1>
<p>Fecha del pedido: <strong>' . $fecha_actual . '</strong></p>
<p>Nombre del solicitante: <strong>' . $nombre . '</strong></p>
<p>Nombre de la Empresa: <strong>' . $empresa . '</strong></p>
<p>Email: <strong>' . $email . ' </strong></p>
<hr>
<p>Este mensaje ha sido generado automaticamente desde...</p>
</body>
</html>';
$encabezado .= "MINE-Version: 1.0\r\n";
$encabezado .= "Content-type: text/html; charset-UTF-8\r\n";
$envio = mail($email,$titulo,$contenido,$encabezado,$cadena_final);
?>
<!DOCTYPE html>
<html lang="es">
<meta charset="UTF-8">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Guarda Pedido</title>
<link rel="stylesheet" type="text/css" href="aaaaaaaa">
</head>
<body>
<div class="ventana">
<center>
<div class="estilo_caja3">
<?php
if($resultado>0){
?>
<form name='datos' action="xxxxxx' method='post'>
<h5>Su pedido ya fue recibido</h5>
<button type="submit">Click para finalizar</button>
</form>
<?php }else{
?>
<p></p>
<form name='datos' <form name='datos' action='
xxxx.php method='post'>
<h5>Error al solicitar pedido...!</h5>
<button type="submit">Regresar a la solicitud</button>
</form>
<?php
}
?>
</center>
</div>
</body>
</html>
Este es el error en el correo:
A message that you sent contained a recipient address that was incorrectly
constructed:
<p>Producto: malformed address: Producto: may not follow <p>
The message has not been delivered to any recipients.
------ This is a copy of your message, including all the headers. ------
Valora esta pregunta


0