PHP - ayuda en formulario-no envia los datos al correo

 
Vista:

ayuda en formulario-no envia los datos al correo

Publicado por fito (1 intervención) el 17/07/2019 22:18:35
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
 
extract($_REQUEST,EXTR_SKIP);
function prepara_formato($archivo)
{
    // global $Nombre,$_SERVER,$PHP_SELF;
 
     global $tnombre,$tarea,$truc,$tdireccion,$tmotivo,$tcorreo,$tmessage;
 
     $fp=fopen($archivo,"r");
     $contenido=fread($fp,filesize($archivo));
     fclose($fp);
     $contenido = preg_match("{tnombre}",$tnombre,$contenido);
     $contenido = preg_match("{tarea}",$tarea,$contenido);
     $contenido = preg_match("{truc}",$truc,$contenido);
     $contenido = preg_match("{tdireccion}",$tdireccion,$contenido);
     $contenido = preg_match("{tmotivo}",$tmotivo,$contenido);
     $contenido = preg_match("{tcorreo}",$tcorreo,$contenido);
     $contenido = preg_match("{tmessage}",$tmessage,$contenido);
 
     return $contenido;
}
 
if($hiddenaccion=="registrar"){// se va a registrar las opciones del menu
    //$correo_destinatario = "coordinador_proyectos@ilmav.org"; //La dirección que recibirá el correo
    $correo_destinatario = "abmsistemas@hotmail.com"; //La dirección que recibirá el correo
    $correo_nombre = "ADMINISTRACION";        //El nombre de la persona del correo
    $motivo_empresa = "Autorizacion de Salida"; //El conocido Subject o Motivo
 
//Esta función es la encargada de reemplazar las variables que nos hemos creado
//  entre corchetes por las recibidas por el fomulario, toma como parametro la
//  ruta del archivo y retorna todo el texto con las variables cambiadas.		
 
    $boundary = md5(time().rand(1,100));
    $priorities = array(1=>'1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)' );
    $priority = $priorities[3];
    $headers = "From: $correo_nombre <$correo_destinatario>\r\n";
    $headers .= "Return-Path: $correo_destinatario\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "X-Mailer:PHP 7.2\r\n";
    $headers .= "X-Priority: $priority\r\n";
    //$headers .= "Content-Type: multipart/mixed;";
    $headers .= "Content-Type: multipart/alternative; ";
    $headers .= "boundary = $boundary\r\n\r\n";
 
    $archivo="mail1.html";
    $contenido=prepara_formato($archivo);
    $cuerpo_1 .= "--$boundary\r\n" .
    "Content-Type: text/html; charset=ISO-8859-1\r\n" .
    "Content-Transfer-Encoding: base64\r\n\r\n";
    $cuerpo_1 .= chunk_split(base64_encode($contenido));
 
    mail($correo_destinatario,$motivo_empresa,$cuerpo_1,$headers);
 
    echo "<script languaje='javascript'>";
    echo "alert('Se envio el formulario satisfactoriamente , con una copia a su correo!!!');";
    echo "</script>";
 
}
 
?>
<html>
<style type="text/css">
<!--
/* CSS Document */

#footer{margin:0 auto; height:81px; background:url(../images/b_footer.gif) 0 0 repeat-x;  margin-top:15px}
#footer p{padding: 25px 0 0 0; font:10px/14px Tahoma, Geneva, sans-serif; font-weight:normal; text-align:center; color:#fff;}
#footer p a{font:10px/14px Tahoma, Geneva, sans-serif; font-weight:normal; color:#fff; text-decoration:none; padding: 0 3px }
#footer p a:hover{text-decoration:none; background:#fff; color:#000}
.Estilo4 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;	
	font-weight:bold

}
.Estilo5 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;		
}
.Estilo6 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; }
-->
</style>
<body>
<script language="JavaScript">
function imprimir(){
document.all.item("noprint").style.visibility='hidden'
window.print()
document.all.item("noprint").style.visibility='visible'
}
</script>
 
<table width= "90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="4">    <div align="center"><span class="Estilo6">PAPELETA DE AUTORIZACION DE SALIDA</span><br>
           </div></td>
    <td ><img src="formulario1_clip_image002.jpg" align="right"> </td>
  </tr>
 
  <tr><td colspan="5"><hr noshade size="1" color="#cccccc"></td></tr>
  <tr>
    <td colspan="5" ><table width="90%"  border="0">
 
  <tr class="Estilo4">
    <td width="15%"  >NOMBRE Y APELLIDOS: </td>
    <td width="33%"  ><? echo $tnombre ?></td>
    <td width="9%"  >AREA DE TRABAJO:  </td>
    <td width="41%"  ><? echo $tarea ?></td>
  </tr>
  <tr class="Estilo4">
    <td  >HORARIO:DIA/MES/A&Ntilde;O </td>
    <td  ><? echo $truc ?></td>
    <td  >HORA DE SALIDA:   </td>
    <td  ><? echo $tdireccion ?></td>
  </tr>
  <tr class="Estilo4">
    <td  >MOTIVO:  </td>
    <td ><? echo $tmotivo ?></td>
    <td>HORA DE RETORNO: </td>
    <td  ><? echo $tcorreo ?> </td>
  </tr>
  <tr class="Estilo4">
    <td >FUNDAMENTACION: </td>
    <td colspan='3'><? echo $tmessage ?></td>
  </tr>
    </table></td>
  </tr>
 
  <tr>
    <td colspan="5" ><hr size="1" noshade color="#cccccc"></td>
    </tr>
  <!--<tr bgcolor="#39C1BB" class="Estilo4">
    <td width="67" ><div align="center">FECHA <br>          <span >SOLICITUD</span></div></td>
    <td width="289" ><div align="center">DESCRIPCION DEL PEDIDO </div></td>
    <td width="84" ><div align="center">CANT.</div></td>
    <td width="106"  ><div align="center">FECHA PLAZO<br>       A ENTREGAR </div></td>
    <td ><div align="center">DIRECCION DE ENTREGA DEL PEDIDO </div></td>
  </tr>-->
 
 
    </table>  </td></tr>
 
  <tr>
    <td colspan="5"  >&nbsp;	</td>
  </tr>
  <tr>
    <td colspan="5"><div id=noprint><div align="center">
	  <img src="imprimir.gif" alt="imprimir" style="cursor: hand;"  onClick="javascript:imprimir();"></div></div></td>
  </tr>
 
</table>
</body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder