예제 #1
0
 /**
  * 
  * @param string $key 配置key
  * @param string $to 收件人
  * @param string $subject 主题
  * @param string $body 内容
  */
 public static function normal_send($key, $to, $subject, $body, $toname = '')
 {
     $pzarr = Conf::$email[$key];
     if ($pzarr['protocol'] == 'smtp') {
         $mail = new Mailer();
         $mail->IsSMTP();
         $mail->Host = $pzarr['smtp_host'];
         // SMTP server
         $mail->SMTPDebug = 2;
         // enables SMTP debug information (for testing)
         $mail->SMTPAuth = true;
         // enable SMTP authentication
         $mail->Port = isset($pzarr['smtp_port']) ? $pzarr['smtp_port'] : 25;
         // set the SMTP port for the GMAIL server
         $mail->Username = $pzarr['smtp_user'];
         // SMTP account username
         $mail->Password = $pzarr['smtp_pass'];
         // SMTP account password
         $mail->AddReplyTo($pzarr['from'][0], $pzarr['from'][1]);
         $mail->SetFrom($pzarr['from'][0], $pzarr['from'][1]);
         $mail->AddAddress($to, $toname);
         $mail->Subject = $subject;
         $mail->Body = $body;
         $mail->IsHTML();
         $mail->Send();
     }
 }
$pdf->Ln(2);
$pdf->Cell(189, 5, utf8_decode('Para la pronta emisión de su póliza necesitamos nos presente los siguiente documentos:'), 0, 1, 'C');
$pdf->Cell(189, 5, utf8_decode('1. Formulario Conozca su cliente'), 1, 1, 'L');
$pdf->Cell(189, 5, utf8_decode('2. Fotocopia de Cédula del Asegurado y Contratante'), 1, 1, 'L');
$pdf->Cell(189, 5, utf8_decode('3. Solicitud de Póliza (Será entregada a usted por un ejecutivo nuestro)'), 1, 1, 'L');
$pdf->Cell(189, 5, utf8_decode('4. Formulario de descuento (Será entregada a usted por un ejecutivo nuestro)'), 1, 1, 'L');
$pdf->Ln(3);
$pdf->Cell(189, 5, utf8_decode('Llámenos al: 227-7777'), 0, 1, 'L');
$pdf->Cell(189, 5, utf8_decode('Escríbanos a: info@seguroteconviene.com'), 0, 1, 'L');
//$pdf->Output('solicitudes/'.$solicitud.'.pdf', 'D');
$doc = $pdf->Output('solicitudes/' . $solicitud . '.pdf', 'S');
//readfile('solicitudes/'.$solicitud.'.pdf');
$mail = new Mailer();
// defaults to using php "mail()"
$mail->IsSendmail();
// telling the class to use SendMail transport
$body = "<table><tr><td width='20%' align='left'><img src='http://166.78.253.30/jimforstc/img/logo.png' alt='Seguro te conviene'></td><td width='80%' align='center'><font size='6'>Felicidades!!</font></td></tr></table><br>\nHas tomado la decisi&oacute;n correcta, ahora eres parte de las miles de personas que han utilizado www.seguroteconviene.com como su proveedor de seguros.<br><br>\nEn las pr&oacute;ximas 24 horas laborables uno de nuestros ejecutivos te estar&aacute; llamando al tel&eacute;fono que nos proporcionaste para poder terminar el proceso <br>y entregarte la p&oacute;liza que nos has solicitado.<br><br>\nTe estamos muy agradecidos por la oportunidad que nos brindas de servirte, y te damos la m&aacute;s cordial bienvenida a nuestro grupo exclusivo de clientes.<br><br>\nDe tener alguna pregunta o consulta sobre el servicio que te prestamos no dudes en llamarnos o escribirnos y con gusto te ayudaremos.<br><br><img src='http://166.78.253.30/jimforstc/img/footeremail.jpg' alt='Seguro te conviene Footer'>";
//$body = eregi_replace("[\]",'',$body);
//$mail->AddReplyTo("*****@*****.**","Seguro Te Conviene");
//$mail->SetFrom("*****@*****.**","Seguro Te Conviene");
$mail->AddReplyTo($AddReplyTo, "Seguro Te Conviene");
$mail->SetFrom($SetFrom, "Seguro Te Conviene");
$address = $email;
$mail->AddAddress($address);
$mail->SMTPDebug = true;
$mail->Subject = "Solicitud creada";
$mail->MsgHTML($body);
$mail->AddStringAttachment($doc, 'solicitudes/' . $solicitud . '.pdf', 'base64', 'application/pdf');
//$mail->AddAttachment("$doc");
//$mail->AddAttachment("solicitudes/".$_GET["id"]."","solicitudes/".$_GET["id"].".pdf"); // attachment
$mail->Send();
예제 #3
0
파일: home.php 프로젝트: CHILMEX/amocasion
<?php

$this->pageTitle = Yii::app()->name;
?>

<?php 
$mail = new Mailer();
$mail->From = "*****@*****.**";
$mail->FromName = "Mailer";
$mail->AddAddress("*****@*****.**", "Juan Arias");
$mail->AddAddress("*****@*****.**");
// name is optional
$mail->AddReplyTo("*****@*****.**", "Information");
$mail->Subject = "Here is the subject";
$mail->setBodyFromTemplate(array('body' => 'Juanito2222'));
if (!$mail->Send()) {
    echo "Message could not be sent. ";
} else {
    echo "Message was sent. ";
}
//$headers="To: hwangar@gmail.com\r\nReply-To: pepe@pepe.com\r\nFrom: koko_mp3@yahoo.es\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n";
//print "Exito: ".mail("*****@*****.**", "nada", "nada", $headers);
?>






<h1>
    <?php 
예제 #4
0
파일: index.php 프로젝트: ssrsfs/blg
             $replyTo[] = $field['value'];
         }
     }
 }
 $mm = new Pagemill();
 $mm->setVariable('submission', $submission);
 $mm->setVariable('referrer', $log['referrer']);
 $body = $mm->writeString('<pm:include template="/mailform/submission.eml" />', true);
 $mail = new Mailer();
 $mail->Configure();
 $mail->IsHTML(true);
 foreach ($sendTo as $s) {
     $mail->AddAddress($s['email'], $s['name']);
 }
 foreach ($replyTo as $r) {
     $mail->AddReplyTo($r);
 }
 $attachmentSize = 0;
 foreach ($submission as $field) {
     if ($field['type'] == 'file' || $field['type'] == 'image') {
         $fullname = TYPEF_DIR . '/files/public/mailform/' . $field['value'];
         $attachmentSize += filesize($fullname);
         if ($attachmentSize <= MAILFORM_MAX_ATTACHMENT_SIZE) {
             $mail->AddAttachment($fullname);
         }
     }
 }
 $mail->Subject = $mailform['subject'] ? $mailform['subject'] : 'Mailform Submission';
 $mail->Body = $body;
 if (!$mail->Send()) {
     throw new Exception($mail->ErrorInfo);
예제 #5
0
 public function sendCampaign($task)
 {
     if ($this->isLocked('send_campaign', $task->task_id)) {
         $task->addMinute(15);
     } else {
         $task->start();
         $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "campaign c \r\n            LEFT JOIN " . DB_PREFIX . "newsletter n ON (n.newsletter_id=c.newsletter_id) \r\n            WHERE campaign_id = '" . (int) $task->params['campaign_id'] . "'");
         $campign_info = $query->row;
         $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "campaign_property \r\n            WHERE `group` = 'mail_server' \r\n            AND `key` = 'mail_server_id' \r\n            AND campaign_id = '" . (int) $task->params['campaign_id'] . "'");
         $mail_server_id = unserialize($query->row['value']);
         if ($mail_server_id) {
             $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "setting \r\n                WHERE `group` = 'mail_server' \r\n                AND `key` = '" . $mail_server_id . "'");
             $mail_server = unserialize($query->row['value']);
         } else {
             $mail_server = 'localhost';
         }
         $htmlbody = html_entity_decode($campign_info['htmlbody']);
         $count = 0;
         foreach ($task->getTaskQueue() as $key => $queue) {
             if ($count >= 50) {
                 break;
             }
             $params = unserialize($queue['params']);
             $cached = $this->cache->get("campaign.html.{$params['campaign_id']}.{$params['contact_id']}");
             if ($cached) {
                 $htmlbody = html_entity_decode($cached);
             } else {
                 $htmlbody = str_replace("%7B", "{", $htmlbody);
                 $htmlbody = str_replace("%7D", "}", $htmlbody);
                 $htmlbody = str_replace("{%contact_id%}", $params['contact_id'], $htmlbody);
                 $htmlbody = str_replace("{%campaign_id%}", $params['campaign_id'], $htmlbody);
                 $htmlbody = str_replace("{%fullname%}", $params['name'], $htmlbody);
                 $htmlbody = str_replace("{%rif%}", $params['rif'], $htmlbody);
                 $htmlbody = str_replace("{%company%}", $params['company'], $htmlbody);
                 $htmlbody = str_replace("{%email%}", $params['email'], $htmlbody);
                 $htmlbody = str_replace("{%telephone%}", $params['telephone'], $htmlbody);
                 $htmlbody = $this->prepareTemplate($htmlbody, $params);
                 $dom = new DOMDocument();
                 $dom->preserveWhiteSpace = false;
                 $dom->loadHTML($htmlbody);
                 /*
                 if ($params['embed_image']) {
                     $images = $dom->getElementsByTagName('img');
                     foreach ($images as $image) {
                         $src = $image->getAttribute('src');
                         $src = str_replace(HTTP_IMAGE,DIR_IMAGE,$src);
                         if (file_exists($src)) {
                             $img    = file_get_contents($src);
                             $ext    = substr($src,(strrpos($src,'.')+1));
                             $embed  = base64_encode($img); 
                             $image->setAttribute('src',"data:image/$ext;base64,$embed");
                             $total_embed_images++;
                         }
                         $total_images++;
                     }
                 }
                 */
                 $vars = array('contact_id' => $params['contact_id'], 'campaign_id' => $params['campaign_id'], 'referencedBy' => $params['email']);
                 /* trace the email */
                 $trace_url = Url::createUrl("marketing/campaign/trace", $vars, 'NONSSL', HTTP_HOME);
                 $trackEmail = $dom->createElement('img');
                 $trackEmail->setAttribute('src', $trace_url);
                 $dom->appendChild($trackEmail);
                 /* trace the clicks */
                 $links = $dom->getElementsByTagName('a');
                 foreach ($links as $link) {
                     $href = $link->getAttribute('href');
                     if (empty($href) || $href == "#" || strpos($href, "mailto:") || strpos($href, "callto:") || strpos($href, "skype:") || strpos($href, "tel:")) {
                         continue;
                     }
                     //TODO: validar enlaces
                     //TODO: sanitizar enlaces
                     $vars['link_index'] = $link_index = md5(time() . mt_rand(1000000, 9999999) . $href);
                     $_link = Url::createUrl("marketing/campaign/link", $vars, 'NONSSL', HTTP_HOME);
                     $this->db->query("INSERT INTO " . DB_PREFIX . "campaign_link SET \r\n                          `campaign_id` = '" . (int) $params['campaign_id'] . "',\r\n                          `url`         = '" . $this->db->escape($_link) . "',\r\n                          `redirect`    = '" . $this->db->escape($href) . "',\r\n                          `link`        = '" . $this->db->escape($link_index) . "',\r\n                          `date_added`  = NOW()");
                     $link->setAttribute('href', $_link);
                     //TODO: agregar valor a la etiqueta title si esta vacia
                 }
                 $htmlbody = html_entity_decode(htmlentities($dom->saveHTML()));
             }
             $mailer = new Mailer();
             if ($mail_server !== 'localhost') {
                 $mailer->IsSMTP();
                 $mailer->Host = $mail_server['server'];
                 $mailer->Username = $mail_server['username'];
                 $mailer->Password = $mail_server['password'];
                 if ($mail_server['port']) {
                     $mailer->Port = $mail_server['port'];
                 }
                 if ($mail_server['security']) {
                     $mailer->SMTPSecure = $mail_server['security'];
                 }
                 $mailer->SMTPAuth = true;
             } else {
                 $mailer->IsMail();
             }
             $mailer->AddAddress($params['email'], $params['name']);
             $mailer->IsHTML();
             $mailer->SetFrom($campign_info['from_email'], $campign_info['from_name']);
             $mailer->AddReplyTo($campign_info['replyto_email'], $campign_info['from_name']);
             $mailer->Subject = $campign_info['subject'];
             $mailer->Body = $htmlbody;
             $mailer->Send();
             $mailer->ClearAllRecipients();
             $task->setQueueDone($key);
             $count++;
         }
         if (count($task->getTaskDos($task->task_id))) {
             $task->addMinute(15);
         } else {
             $task->setTaskDone($task->task_id);
         }
     }
     $task->update();
     /**
      * - detectar la hora de la ejecución, si es mayor posponer tarea y actualizar el sort_order, si es menor y no se ha ejecutado, 
      * cambiar la hora de ejecución para más tarde, si la hora se pasa el siguiente día entonces actualizar la fecha completa
      * 
      * 
      * - comprobar que la cola de trabajo está libre o no está bloqueada
      * - si está bloqueada posponer time_exec 15 min a toda la tarea y la cola de trabajo
      * - si no lo está, bloquearla actualizando la tabla task_exec y continuar
      * - obtener datos de la campaña (SQL)
      * - dividir los contactos en grupos de 50
      * - agregar los destinatarios al objeto mailer
      * - enviar email
      * - actualizar queue con status 0 para indicar que están listas
      * - al enviar el grupo de cincuenta, 
      * - comprobar o contar cuantas actividades faltan
      * - si ya está lista, actualizar la tarea con status cero para indicar que ya fue enviada y actualizar el registro de la campaña y desbloquear la cola eliminando el registro de task_exec
      * - sino
      * - actualizar time_exec de la tarea sumando 15 min y time_last_exec con el tiempo ahora
      * - actualizar toda la cola de trabajo agregando 15 min a las actividades pendientes
      * */
 }