source: trunk/spip/esqueleto-redcta/plugins/enviar_email/enviar_email_breve.html @ 30

Last change on this file since 30 was 30, checked in by sebas, 17 years ago

nueva importacion del codigo del esqueleto de redcta con los plugins

File size: 11.9 KB
Line 
1#CACHE{0}
2<BOUCLE_enviar_breve(BREVES){id_breve}>
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">
5
6<head>
7        <title>[Enviar breve: (#TITRE|textebrut)]</title>
8       
9        <!-- Para los buscadores -->
10        <meta http-equiv="Content-Type" content="text/html; charset=#CHARSET" />
11        <meta name="robot" content="follow, index, all">
12        <meta name="revisit-after" content="1 days">
13        <meta name="generator" content="SPIP" />
14        [<meta name="description" content="(#INTRODUCTION|couper{150}|attribut_html)" />]
15        <meta name="keywords" content="">
16
17
18<style type="text/css">
19<!--
20
21h2 {
22        font-size:130%;
23        font-weight:bold;
24}
25
26.formulario {
27        background-color: white;
28        border: 0px solid silver;
29        font-family: Verdana, Arial, Helvetica, sans-serif;
30        font-size:75%;
31        margin-top:.9em;
32}
33       
34.campos {
35        width: 95%;
36        padding-left: 2px;
37        padding-right: 2px;
38        padding-top:1px;
39        padding-bottom:1px;
40        font-size: 110%;
41        color:#333333;
42        margin-bottom:.3em;
43        border:1px solid #B2BFCF;
44}
45       
46.spip_bouton {
47        padding: 0px;
48        border: 1px solid gray;
49        background-color: whitesmoke;
50        font-family: verdana,helvetica,arial,sans-serif;
51        color: #666666;
52        font-size: 100%;
53}
54-->
55</style>
56
57</head>
58
59<body style="border:0px; padding:0px; text-align:center">
60#NOM_SITE
61<?php
62if (!$HTTP_POST_VARS){
63
64// MUESTRA EL FORMULARIO
65?>
66
67<div style="width:95%; margin:auto;">
68  <form action="<?php $phpself; ?>" method="POST" enctype="multipart/form-data" class="formulario">
69        <h2 style="text-align:center; margin-bottom:.2em"><span style="text-decoration:underline">#NOM_SITE_SPIP</span><div style="font-weight:normal; font-size:80%; margin-top:.6em;">Enviar [la referencia de "<span style="font-weight:bold; font-style: italic">(#TITRE)</span>" ]por correo electrónico</div></h2>
70    <fieldset style="text-align:left; margin-bottom:.6em">
71   <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>
72       <fieldset style="text-align:left">
73       <legend style="font-weight:bold">Datos opcionales</legend>
74    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/>
75      Tu nombre<br /><input name="nombre" class="campos" size="40" value=""><br/>
76     Tu dirección de correo electrónico<br /><input name="email" class="campos" size="40" value=""><br />
77     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>
78     <div style="text-align:center">
79      <input type="submit" name="enviar" class="spip_bouton" style="margin-top:.3em" value="Enviar">&nbsp;&nbsp;&nbsp;<input type="button"  class="spip_bouton" style="margin-top:.3em" value="Cancelar" onclick="window.close();"> 
80      </div>
81      <input type="hidden" name="message" value="1">
82      </fieldset>
83  </form> 
84</div>
85
86<?php
87}else{
88
89// REVISA QUE HAYA UN EMAIL PARA ENVIAR EL MENSAJE
90if (!$destino) { echo "<p style='color:red; font-size:90%'>Lo sentimos :-(, pero sin dirección de correo electrónico válida no podemos enviar el mensaje</p>";
91
92?>
93
94<div style="width:90%; margin:auto;">
95  <form action="<?php $phpself; ?>" method="POST" enctype="multipart/form-data" class="formulario">
96        <h2 style="text-align:center; margin-bottom:.2em"><span style="text-decoration:underline">#NOM_SITE_SPIP</span><div style="font-weight:normal; font-size:80%; margin-top:.6em;">Enviar [la referencia de "<span style="font-weight:bold; font-style: italic">(#TITRE)</span>" ]por correo electrónico</div></h2>
97    <fieldset style="text-align:left; margin-bottom:.6em">
98   <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>
99       <fieldset style="text-align:left">
100       <legend style="font-weight:bold">Datos opcionales</legend>
101    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/>
102      Tu nombre<br /><input name="nombre" class="campos" size="40" value=""><br/>
103     Tu dirección de correo electrónico<br /><input name="email" class="campos" size="40" value=""><br />
104     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>
105     <div style="text-align:center">
106      <input type="submit" name="enviar" class="spip_bouton" style="margin-top:.3em" value="Enviar">&nbsp;&nbsp;&nbsp;<input type="button"  class="spip_bouton" style="margin-top:.3em" value="Cancelar" onclick="window.close();"> 
107      </div>
108     
109      <input type="hidden" name="message" value="1">
110     
111      </fieldset>
112  </form> 
113</div>
114      <input type="hidden" name="message" value="1">
115      </fieldset>
116  </form> 
117</div>
118
119<?php
120}else {
121
122// ENVÍO DEL MENSAJE CON PHPMAILER
123
124include_spip("phpmailer/class.phpmailer");
125include_spip("phpmailer/class.smtp");   
126include_spip('inc/meta'); // para coger datos automáticamente del servidor, usuario,...
127$mail = new PHPMailer();
128
129$mail->IsSMTP();
130$mail->Mailer = "smtp";
131$mail->Host     = "localhost"; // Servidor de SMTP
132
133$mail->SetLanguage("es", "phpmailer/language/");
134$mail->CharSet  = lire_meta('charset');  // Juego de caracteres
135$mail->Timeout="20";
136
137$mail->WordWrap = "75";                                 // set word wrap to 50 characters
138//$mail->AddAttachment("/var/tmp/file.tar.gz");         // añadir archivos
139//$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // añadir archivos con nombre
140
141// VARIABLES
142
143$un_salto="\r\n";
144$dos_saltos="\r\n\r\n";
145
146// PARTE COMÚN
147
148    //Estoy recibiendo los campos, compongo el cuerpo
149   
150    if (!$HTTP_POST_VARS["nombre"]) { $remite= "Olvidó escribir su nombre"; } else { $remite= $HTTP_POST_VARS["nombre"]; }
151    $mail->FromName = $remite; // de nombre
152    $mail->From = $HTTP_POST_VARS["nombre"]; // de email
153   
154        if (!$HTTP_POST_VARS["email"]) { $replica = "[(#EMAIL_WEBMASTER)]"; } else { $replica = $HTTP_POST_VARS["email"]; }
155        $mail->AddReplyTo($replica); // reply
156   
157    $separar = explode(',',$destino);
158        foreach($separar as $email_destino) {
159                $mail->AddAddress($email_destino); // para
160                };
161       
162    if (!$HTTP_POST_VARS["asunto"]) { $asunto='[(#TITRE|texte_script)]'; } else { $asunto=$HTTP_POST_VARS["asunto"]; }
163    $mail->Subject = $asunto; // Asunto
164
165// COMIENZO PARTE TEXTO PLANO
166
167//Referencia al artículo para el texto plano
168?>
169
170<B_autores>
171<BOUCLE_autores(AUTEURS){id_breve}{", "}>
172<?php $autores='#NOM'; ?>
173</BOUCLE_autores>
174<?php $autores="|de ".$autores; ?>
175</B_autores>
176
177<?php
178        $articulo= "::: [(#TITRE|attribut_html)] :::".$un_salto;
179        $articulo.= "[(#SURTITRE|attribut_html)|][(#SOUSTITRE|attribut_html)|][(#DATE|affdate)]".$autores.$dos_saltos;
180        $articulo.= "[(#INTRODUCTION|attribut_html|textebrut|couper{360})]".$dos_saltos;
181
182        if (!$HTTP_POST_VARS["coment"]) { $comentario="Hola. Quizás este documento de #NOM_SITE_SPIP (#URL_SITE_SPIP) te pueda interesar."; } else { $comentario=$HTTP_POST_VARS["coment"]; }
183    $texto_plano .= $dos_saltos.$comentario.$dos_saltos."-------------------------------".$dos_saltos;
184    $texto_plano .= $articulo;
185    ?>
186<B_documents_plano>
187<?php
188$texto_plano .="Si visitas la web podrás descargarte los siguientes documentos:".$un_salto;
189?>
190<BOUCLE_documents_plano(DOCUMENTS) {id_breve} {mode=document} {doublons}>
191<?php
192$texto_plano .="[- #TITRE, (#TYPE_DOCUMENT - (#TAILLE|taille_en_octets))]".$dos_saltos;
193?>
194</BOUCLE_documents_plano>
195</B_documents_plano>
196
197<?php
198        $texto_plano.= "* leerlo completo: #URL_SITE_SPIP/#URL_BREVE".$un_salto;
199    $texto_plano .= $un_salto."-------------------------------".$un_salto."Mensaje enviado por: ".$remite." <".$replica.">".$un_salto;
200    $texto_plano .= "Fuente: #NOM_SITE_SPIP (#URL_SITE_SPIP)";
201    $texto_plano .= $un_salto."-------------------------------".$un_salto;
202   
203    $mail->AltBody = $texto_plano; //Cuerpo en TEXTO PLANO
204   
205// FIN PARTE TEXTO PLANO
206
207// COMIENZO PARTE HTML
208
209$texto_html .="<div style='margin:1.2em;background: #fff;font-family:\'Trebuchet MS\', Tahoma, Arial, Verdana,sans-serif;font-size: 0.9em;text-align: left;'>";
210        if (!$HTTP_POST_VARS["coment"]) { $comentario="Hola. Quizás este documento de <a href='#URL_SITE_SPIP' style='text-decoration: none'>#NOM_SITE_SPIP</a> te pueda interesar."; } else { $comentario=$HTTP_POST_VARS["coment"]; }
211$texto_html .="<p>".$comentario."</p>";
212$texto_html .="<div style='border: 1px solid #ccc;padding: .5em;'>";
213$texto_html .="[<div style='font-size:1.1em;'><a href='#URL_SITE_SPIP/#URL_BREVE' style='text-decoration: none'>(#TITRE|supprimer_numero)</a></div>]";
214?>
215
216<B_autores_html>
217<BOUCLE_autores_html(AUTEURS){id_breve}{", "}>
218<?php $autores='[<a href="#URL_SITE_SPIP/#URL_AUTEUR" style="text-decoration:none">(#NOM)</a>]'; ?>
219</BOUCLE_autores_html>
220<?php $autores=" / de ".$autores; ?>
221</B_autores_html>
222
223<?php
224$texto_html .="<div style='color:#666666; font-size:90%;padding-bottom:.3em'>[(#SURTITRE|attribut_html) / ][(#SOUSTITRE|attribut_html) / ][(#DATE|affdate)]".$autores."</div>";
225$texto_html .="<div style='font-size:96%'>[(#INTRODUCTION|attribut_html|textebrut)]</div>";
226$texto_html .=" <div style='color:#999999; font-size:90%;'>[<a href='#URL_SITE_SPIP/#URL_BREVE' style='text-decoration: none'>... leer m&aacute;s &rsaquo;&rsaquo;&rsaquo;</a>]</div>";
227?>
228<B_documents>
229<?php
230$texto_html .="<div style='margin-top:.6em;padding:.3em; padding-bottom:0px;border-top:1px solid #cccccc;color:#666666; font-size:85%;'>Si visitas la web podrás descargarte los siguientes documentos:<br />";
231?>
232<BOUCLE_documents(DOCUMENTS) {id_breve} {mode=document} {doublons}>
233<?php
234$texto_html .="[&bull; #TITRE, (#TYPE_DOCUMENT - (#TAILLE|taille_en_octets))]";
235?>
236</BOUCLE_documents>
237<?php
238$texto_html .="</div>";
239?>
240</B_documents>
241<?php
242$texto_html .="</div>";
243$texto_html .= "<div style='margin-top:.2em;margin-bottom:.9em;color:#666666; font-size:80%;text-align:right'>Mensaje enviado por: ".$remite." <".$replica.">";
244$texto_html .= " /// Fuente: <a href='#URL_SITE_SPIP' style='text-decoration: none'>#NOM_SITE_SPIP</a><br /></div>";
245$texto_html .="</div>";
246
247$mail->Body    = $texto_html; //Cuerpo en HTML
248
249// FIN PARTE HTML
250
251// Envío (5 intentos)
252$enviado = $mail->Send();
253$intentos=1;
254        while((!$enviado)&&($intentos<5)&&($mail->ErrorInfo!="SMTP Error: Data not accepted")){
255           sleep(5);
256           //echo $mail->ErrorInfo;
257           $enviado = $mail->Send();
258           $intentos=$intentos+1;                               
259        }
260
261if ($mail->ErrorInfo=="SMTP Error: Data not accepted") { // soluciona un bug con attachements
262           $enviado=true;
263}
264
265//información final sobre el envío
266
267if($enviado)
268{
269echo "<div style='margin-left:15px;margin-right:15px'><center><font color='#333366'><br /><br /><h2 style='text-align:center; font-weight:bold; margin-bottom:.3em'><span style='text-decoration:underline'>#NOM_SITE_SPIP</span></h2><br /><h1 style='text-align:center; font-size:90%'>La referencia de<i><b><div style='padding-top:.6em;padding-bottom:.6em'>\"[(#TITRE|texte_script)]\"</div></b></i>ya se ha enviado a ". $HTTP_POST_VARS["destino"] ."</h1></font></center></div>";
270}
271else{
272echo "<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'>#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>";
273}
274
275// Borro las direcciones de destino establecidas anteriormente
276        $mail->ClearAddresses();
277
278?>
279
280<div style="text-align:center; font-size:90%">
281<br />
282<input type="button"  class="spip_bouton" value="Cerrar" onclick="window.close();">
283</div>
284
285<?php
286}
287}
288?> 
289
290<div style="display:none">
291[(#FORMULAIRE_ADMIN)]
292</div>
293
294</body>
295</html>
296</BOUCLE_enviar_breve>
Note: See TracBrowser for help on using the repository browser.