[30] | 1 | #CACHE{0} |
---|
| 2 | <BOUCLE_enviar_articulo(ARTICLES){id_article}> |
---|
| 3 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
| 4 | <html dir="#LANG_DIR" lang="#LANG" style="background-color:#ffffff"> |
---|
| 5 | |
---|
| 6 | <head> |
---|
| 7 | |
---|
| 8 | <title>[Enviar artículo: (#TITRE|textebrut)]</title> |
---|
| 9 | [<meta name="description" content="(#INTRODUCTION|couper{150}|textebrut)" />] |
---|
| 10 | <INCLURE{fond=inc-head}> |
---|
| 11 | |
---|
| 12 | <style type="text/css"> |
---|
| 13 | <!-- |
---|
| 14 | |
---|
| 15 | h2 { |
---|
| 16 | font-size:130%; |
---|
| 17 | font-weight:bold; |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | .formulario { |
---|
| 21 | background-color:#ffffff; |
---|
| 22 | border: 0px solid silver; |
---|
| 23 | font-size:90%; |
---|
| 24 | margin-top:.9em; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | .campos { |
---|
| 28 | width: 95%; |
---|
| 29 | font-size:90%; |
---|
| 30 | padding-left: 2px; |
---|
| 31 | padding-right: 2px; |
---|
| 32 | padding-top:2px; |
---|
| 33 | padding-bottom:2px; |
---|
| 34 | font-family: Verdana, Arial, Helvetica, sans-serif; |
---|
| 35 | color:#666666; |
---|
| 36 | margin-bottom:.3em; |
---|
| 37 | border:1px solid silver; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | .boton { |
---|
| 41 | padding: 0px; |
---|
| 42 | border: 1px solid silver; |
---|
| 43 | color: #666666; |
---|
| 44 | } |
---|
| 45 | --> |
---|
| 46 | </style> |
---|
| 47 | |
---|
| 48 | </head> |
---|
| 49 | |
---|
| 50 | <body style="border:0px; padding:0px; font-size:90%;text-align:center;background-color:#ffffff;color: #727860;"> |
---|
| 51 | |
---|
| 52 | <?php |
---|
| 53 | |
---|
| 54 | if (!$HTTP_POST_VARS){ |
---|
| 55 | |
---|
| 56 | // MUESTRA EL FORMULARIO |
---|
| 57 | ?> |
---|
| 58 | |
---|
| 59 | <div style="width:90%; margin:auto;padding-top:.6em"> |
---|
| 60 | <form action="<?php $phpself; ?>" method="POST" enctype="multipart/form-data" class="formulario"> |
---|
| 61 | |
---|
| 62 | <h2 style="text-align:center;"><span style="text-decoration:underline;color:#f28000">#NOM_SITE_SPIP</span><div style="font-weight:normal; font-size:80%; margin-top:.9em;margin-bottom:.9em">Enviar [referencia de <span style="font-weight:bold;font-style:italic">'(#TITRE)'</span> ]por correo electrónico</div></h2> |
---|
| 63 | |
---|
| 64 | <fieldset style="text-align:left; margin-bottom:.6em"> |
---|
| 65 | <b>Enviar a la dirección:</b><div style="font-size:95%;color:#999999">(separa con comas si escribes más de una)</div><input name="destino" class="campos" value="" size="40"></fieldset> |
---|
| 66 | <fieldset style="text-align:left"> |
---|
| 67 | <legend style="font-weight:bold">Datos opcionales</legend> |
---|
| 68 | Asunto <span style="font-size:95%;color:#999999">(título que quieres darle al mensaje)</span><br /><input name="asunto" class="campos" size="40" value=""><br/> |
---|
| 69 | Tu nombre<br /><input name="nombre" class="campos" size="40" value=""><br/> |
---|
| 70 | Tu dirección de correo electrónico<br /><input name="email" class="campos" size="40" value=""><br /> |
---|
| 71 | Puedes añadir un texto en el mensaje<br /><textarea name="coment" class="campos" style="font-size:100%; font-family:verdana, arial, helvetica, sans-serif;" cols="40" rows="3"></textarea> |
---|
| 72 | <div style="text-align:center"> |
---|
| 73 | <input type="submit" name="enviar" class="boton" style="margin-top:.3em" value="Enviar"> <input type="button" class="boton" style="margin-top:.3em" value="Cancelar" onclick="window.close();"> |
---|
| 74 | </div> |
---|
| 75 | <input type="hidden" name="message" value="1"> |
---|
| 76 | </fieldset> |
---|
| 77 | </form> |
---|
| 78 | </div> |
---|
| 79 | |
---|
| 80 | <?php |
---|
| 81 | }else{ |
---|
| 82 | |
---|
| 83 | // REVISA QUE HAYA UN EMAIL PARA ENVIAR EL MENSAJE |
---|
| 84 | if (!$destino) { echo "<p style='color:red; font-size:90%'>Lo sentimos :-( pero sin dirección de correo electrónico válida<br />no podemos enviar el mensaje</p>"; |
---|
| 85 | |
---|
| 86 | ?> |
---|
| 87 | |
---|
| 88 | <div style="width:90%; margin:auto;"> |
---|
| 89 | <form action="<?php $phpself; ?>" method="POST" enctype="multipart/form-data" class="formulario"> |
---|
| 90 | <h2 style="text-align:center; margin-bottom:.1em"><span style="text-decoration:underline">#NOM_SITE_SPIP</span><div style="font-weight:normal; font-size:80%; margin-top:1.2em">Enviar [referencia de <span style="font-weight:bold; font-style: italic">'(#TITRE)'</span> ]por correo electrónico</div></h2> |
---|
| 91 | <fieldset style="text-align:left; margin-bottom:.6em"> |
---|
| 92 | <b>Enviar a la dirección:</b><div style="font-size:95%;color:#999999">(separa con comas si escribes más de una)</div><input name="destino" class="campos" value="" size="40"></fieldset> |
---|
| 93 | <fieldset style="text-align:left"> |
---|
| 94 | <legend style="font-weight:bold">Datos opcionales</legend> |
---|
| 95 | Asunto <span style="font-size:95%;color:#999999">(título que quieres darle al mensaje)</span><br /><input name="asunto" class="campos" size="40" value=""><br/> |
---|
| 96 | Tu nombre<br /><input name="nombre" class="campos" size="40" value=""><br/> |
---|
| 97 | Tu dirección de correo electrónico<br /><input name="email" class="campos" size="40" value=""><br /> |
---|
| 98 | Puedes añadir un texto en el mensaje<br /><textarea name="coment" class="campos" style="font-size:100%; font-family:verdana, arial, helvetica, sans-serif;" cols="40" rows="3"></textarea> |
---|
| 99 | <div style="text-align:center"> |
---|
| 100 | <input type="submit" name="enviar" class="boton" style="margin-top:.3em" value="Enviar"> <input type="button" class="boton" style="margin-top:.3em" value="Cancelar" onclick="window.close();"> |
---|
| 101 | </div> |
---|
| 102 | |
---|
| 103 | <input type="hidden" name="message" value="1"> |
---|
| 104 | |
---|
| 105 | </fieldset> |
---|
| 106 | </form> |
---|
| 107 | </div> |
---|
| 108 | |
---|
| 109 | <?php |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | // ENVIO DEL MENSAJE CON PHPMAILER |
---|
| 113 | |
---|
| 114 | include_spip("phpmailer/class.phpmailer"); |
---|
| 115 | include_spip("phpmailer/class.smtp"); |
---|
| 116 | include_spip('inc/meta'); // para coger datos automáticamente del servidor, usuario,... |
---|
| 117 | $mail = new PHPMailer(); |
---|
| 118 | |
---|
| 119 | $mail->IsSMTP(); |
---|
| 120 | $mail->Mailer = "smtp"; |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | /* |
---|
| 124 | // SI EL SERVIDOR DE SMTP REQUIERE AUTENTICACION RELLENA ESTOS DATOS CON LOS TUYOS Y ACTIVALO |
---|
| 125 | |
---|
| 126 | //Asignamos a Host el nombre de nuestro servidor smtp |
---|
| 127 | $mail->Host = "smtp.hotpop.com"; |
---|
| 128 | |
---|
| 129 | //Le indicamos que el servidor smtp requiere autenticación |
---|
| 130 | $mail->SMTPAuth = true; |
---|
| 131 | |
---|
| 132 | //Le decimos cual es nuestro nombre de usuario y password |
---|
| 133 | $mail->Username = "micuenta@HotPOP.com"; |
---|
| 134 | $mail->Password = "mipassword"; |
---|
| 135 | */ |
---|
| 136 | |
---|
| 137 | $mail->Host = "localhost"; // Servidor de SMTP |
---|
| 138 | |
---|
| 139 | $mail->SetLanguage("es", "phpmailer/language/"); |
---|
| 140 | $mail->CharSet = lire_meta('charset'); // Juego de caracteres |
---|
| 141 | $mail->Timeout="20"; |
---|
| 142 | |
---|
| 143 | // $mail->WordWrap = "50"; // set word wrap to 50 characters |
---|
| 144 | // $mail->AddAttachment("/var/tmp/file.tar.gz"); // añadir archivos |
---|
| 145 | // $mail->AddAttachment("#DOSSIER_SQUELETTE/imagenes/logo_64.jpg", "logo_64.jpg"); // añadir archivos con nombre |
---|
| 146 | |
---|
| 147 | // PARTE COMÚN |
---|
| 148 | |
---|
| 149 | //Asignamos asunto y cuerpo del mensaje |
---|
| 150 | |
---|
| 151 | //Estoy recibiendo los campos, compongo el cuerpo |
---|
| 152 | |
---|
| 153 | if (!$HTTP_POST_VARS["nombre"]) { $remite= "No ha escrito su nombre"; } else { $remite= $HTTP_POST_VARS["nombre"]; } |
---|
| 154 | $mail->FromName = $remite; // el nombre que queremos que vea |
---|
| 155 | $mail->From = $HTTP_POST_VARS["email"]; // el email del nombre que se ve |
---|
| 156 | |
---|
| 157 | if (!$HTTP_POST_VARS["email"]) { $replica = '[(#EMAIL_WEBMASTER)]'; } else { $replica = $HTTP_POST_VARS["email"]; } |
---|
| 158 | $mail->AddReplyTo($replica); // reply |
---|
| 159 | |
---|
| 160 | $separar = explode(',',$destino); |
---|
| 161 | foreach($separar as $email_destino) { |
---|
| 162 | $mail->AddAddress($email_destino); // para |
---|
| 163 | }; |
---|
| 164 | |
---|
| 165 | if (!$HTTP_POST_VARS["asunto"]) { $asunto='[(#TITRE|texte_script)]'; } else { $asunto=$HTTP_POST_VARS["asunto"]; } |
---|
| 166 | $mail->Subject = $asunto; // Asunto |
---|
| 167 | |
---|
| 168 | // COMIENZO PARTE HTML |
---|
| 169 | |
---|
| 170 | $sitio='[(#NOM_SITE_SPIP)]'; |
---|
| 171 | $url_sitio='[(#URL_SITE_SPIP)]'; |
---|
| 172 | $url_art='[(#URL_ARTICLE)]'; |
---|
| 173 | |
---|
| 174 | $texto_html ="<div style='margin:1.2em;font-family:tahoma,verdana,arial,helvetica,sans-serif;background-color:#ffffff;color:#727860;border:1px solid #f28000'>"; |
---|
| 175 | |
---|
| 176 | $texto_html.="<p style='padding:0px;margin:0px;text-align:left;font-size:120%;font-weight:bold;background-color:#f28000'><a href='$url_sitio' style='display:block;text-decoration:none;color:#edef9f;padding:.3em'><img src='logo_64.jpg' border='0' /> ".$sitio."</a></p>"; |
---|
| 177 | |
---|
| 178 | $texto_html.="<div style='padding:.9em;padding-top:0px'>"; |
---|
| 179 | |
---|
| 180 | if (!$HTTP_POST_VARS["coment"]) { $comentario="Hola. Quizás esta información te pueda interesar."; } else { $comentario=$HTTP_POST_VARS["coment"]; } |
---|
| 181 | $texto_html.="<p style='text-align:left'>".$comentario."</p>"; |
---|
| 182 | |
---|
| 183 | $texto_html.="<div style='border: 1px solid silver;background-color:whitesmoke'>"; |
---|
| 184 | $texto_html.="<div style='font-size:120%;padding:.3em;text-align:center;border-bottom:1px dotted silver'>".'[(#TITRE)]'."</div>"; |
---|
| 185 | $texto_html.="<div style='padding:.9em;padding-bottom:.3em;font-size:95%;'>".'[(#TEXTE|couper{1200})]'."</div>"; |
---|
| 186 | $texto_html.="<div style='font-size:90%;text-align:right;padding-bottom:.6em;padding-right:.9em'><a href='$url_sitio/$url_art'>leer más ›››</a></div>"; |
---|
| 187 | $texto_html.="</div>"; |
---|
| 188 | |
---|
| 189 | if (!$HTTP_POST_VARS["email"]) { $email_aut=""; } else { $email_aut=" (".$HTTP_POST_VARS["email"].")"; } |
---|
| 190 | $texto_html.="<div style='font-size:80%;color:#999999;text-align:left'>Envíado por: ".$remite.$email_aut."</div>"; |
---|
| 191 | |
---|
| 192 | $texto_html.="</div></div>"; |
---|
| 193 | |
---|
| 194 | $mail->Body = $texto_html; |
---|
| 195 | |
---|
| 196 | // COMIENZO PARTE TEXTO PLANO |
---|
| 197 | |
---|
| 198 | if (!$HTTP_POST_VARS["coment"]) { $comentario="Hola. Quizás esta información te pueda interesar."; } else { $comentario=$HTTP_POST_VARS["coment"]; } |
---|
| 199 | $texto_plano=$comentario."\n\n"; |
---|
| 200 | $texto_plano.="-------------------------- \n"; |
---|
| 201 | $texto_plano.='[(#NOM_SITE_SPIP)]'."\n".'[(#URL_SITE_SPIP)]'."\n\n"; |
---|
| 202 | $texto_plano.='[(#TITRE)]'."\n\n"; |
---|
| 203 | $texto_plano.='[(#TEXTE|couper{1200})]'."\n\n"; |
---|
| 204 | $texto_plano.="leer más: ".$url_sitio."/".$url_art."\n\n"; |
---|
| 205 | $texto_plano.="-------------------------- \n"; |
---|
| 206 | $texto_plano.="Envíado por: ".$remite.$email_aut; |
---|
| 207 | |
---|
| 208 | |
---|
| 209 | $mail->AltBody = $texto_plano; |
---|
| 210 | |
---|
| 211 | // SE ENVÍA EL MENSAJE |
---|
| 212 | |
---|
| 213 | // Envío (5 intentos) |
---|
| 214 | $enviado = $mail->Send(); |
---|
| 215 | $intentos=1; |
---|
| 216 | while((!$enviado)&&($intentos<5)&&($mail->ErrorInfo!="SMTP Error: Data not accepted")){ |
---|
| 217 | sleep(5); |
---|
| 218 | //echo $mail->ErrorInfo; |
---|
| 219 | $enviado = $mail->Send(); |
---|
| 220 | $intentos=$intentos+1; |
---|
| 221 | } |
---|
| 222 | |
---|
| 223 | if ($mail->ErrorInfo=="SMTP Error: Data not accepted") { // soluciona un bug con attachements |
---|
| 224 | $enviado=true; |
---|
| 225 | } |
---|
| 226 | |
---|
| 227 | //información final sobre el envío |
---|
| 228 | |
---|
| 229 | if($enviado) |
---|
| 230 | { |
---|
| 231 | echo "<div style='margin-left:15px;margin-right:15px'><center><br /><br /><h2 style='text-align:center; font-weight:bold; margin-bottom:.6em'><span style='text-decoration:underline;color:#f28000'>".'[(#NOM_SITE_SPIP)]'."</span></h2><br /><h1 style='text-align:center;font-size:95%'>La referencia de<i><b><div style='padding-top:.9em;padding-bottom:.9em;font-size:115%'>\"".'[(#TITRE|texte_script)]'."\"</div></b></i><div style='padding-bottom:.6em'>ya se ha enviado a:</div>"; |
---|
| 232 | foreach($separar as $email_destino) { echo $email_destino."<br />"; } |
---|
| 233 | echo "</h1 />"; |
---|
| 234 | } |
---|
| 235 | else{ |
---|
| 236 | echo "<div style='margin-left:15px;margin-right:15px'><center><font color='red'><br /><br /><h2 style='text-align:center; font-weight:bold; margin-bottom:.3em'><span style='text-decoration:underline;color:#f28000'>".'[(#NOM_SITE_SPIP)]'."</span></h2><br /><h1 style='text-align:center;font-size:90%'>Lo sentimos<br />Ha habido un problema y no se ha podido enviar el correo :-(</h1></font></center></div>"; |
---|
| 237 | } |
---|
| 238 | |
---|
| 239 | ?> |
---|
| 240 | |
---|
| 241 | <div style="text-align:center"> |
---|
| 242 | <br /> |
---|
| 243 | <input type="button" class="boton" value="Cerrar" onclick="window.close();"> |
---|
| 244 | </div> |
---|
| 245 | |
---|
| 246 | <?php |
---|
| 247 | |
---|
| 248 | } |
---|
| 249 | ?> |
---|
| 250 | |
---|
| 251 | <div style="display:none"> |
---|
| 252 | [(#FORMULAIRE_ADMIN)] |
---|
| 253 | </div> |
---|
| 254 | |
---|
| 255 | </body> |
---|
| 256 | </html> |
---|
| 257 | </BOUCLE_enviar_articulo> |
---|