function sendQRmail($from, $to, $subject, $msg, $qrcodeImage, $cid, $name) { include_once 'inc/class.phpmailer.php'; $mail = new phpmailer(); $mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only, 0 = off $mail->IsSMTP(); // Set mailer to use SMTP $mail->Host = 'mailhub.eait.uq.edu.au'; // Specify server $mail->Port = 25; // Server port: 465 ssl OR 587 tls //$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted $mail->SMTPAuth = false; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SetFrom($from, 'QRappi'); // Sender $mail->AddReplyTo($from, 'Support'); // Set an alternative reply-to address $mail->AddAddress($to, 'User'); // Set who the message is to be sent to $mail->Subject = $subject; // Set the subject line // Prepares message for html (see doc for details http://phpmailer.worxware.com/?pg=tutorial) $mail->MsgHTML($msg); // Add the image to the email as an inline element (i.e. not as an attachment) $mail->AddStringEmbeddedImage($qrcodeImage, $cid, $name); // Send the message, check for errors $ok = $mail->Send(); return $ok; }
protected function sendEmail($to, $subject, $body) { include_once '../../libraries/phpmailer/class.phpmailer.php'; if (empty($to)) { return false; } $mail = new phpmailer(); $mail->PluginDir = '../../libraries/phpmailer'; $mail->CharSet = 'UTF-8'; $mail->Subject = substr(stripslashes($subject), 0, 900); $mail->From = '*****@*****.**'; $mail->FromName = 'ARIS Mailer'; $mail->AddAddress($to, 'ARIS Author'); $mail->MsgHTML($body); $mail->WordWrap = 79; if ($mail->Send()) { return true; } else { return false; } }
<?php /** * Created by PhpStorm. * User: Viry * Date: 17/11/2015 * Time: 01:42 PM */ require_once '../mail/class.phpmailer.php'; require "../mail/class.smtp.php"; $mail = new phpmailer(); $mail->PluginDir = '../mail/'; $mail->SMTPSecure = "tls"; $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true; $mail->Username = "******"; $mail->Password = "******"; $mail->Port = 587; //puerto de autenticacion que usa gmail $mail->AddAddress("*****@*****.**"); $mail->IsHTML = true; $mail->MsgHTML('Recuperacion de Contraseña <br><br> Contraseña: <br><br> Ingresa a este Link: http://proyectospi.com/PuntodeEncuentroP/html/pages/forgot-password.html <br><br>para Ingresar a tu sesion con la contraseña que te enviamos en este correo.'); $mail->SetFrom("*****@*****.**", "Punto de Encuentro"); $mail > Subject == "Recuperacion de Contraseña"; //indico destinatario $exito = $mail->Send(); if (!$exito) { echo "Error al enviar: " . $mail > ErrorInfo; } else { echo "Mensaje enviado!"; }
function approve_pos($id) { if (isset($this->session->userdata['user'])) { $pos = $_POST['pos']; $has_superviser = false; if ($this->session->userdata['user_type'] == 3) { if ($this->has_store_superviser()) { $has_superviser = true; } } else { if ($this->has_user_superviser()) { $has_superviser = true; } } if ($has_superviser) { foreach ($pos as $key => $item) { $this->orders_model->add_pos($key, mysql_escape_string($item)); } } else { foreach ($pos as $key => $item) { $this->orders_model->approve_pos($key, mysql_escape_string($item)); $verif_code = md5(time()); $this->status_model->insert($key, 0, $verif_code); $mailer = new phpmailer(); $mailer->IsSendmail(); $mailer->From = '*****@*****.**'; $mailer->FromName = 'Belron admin'; $mailer->Subject = utf8_decode('Nouvelle commande ajoutée'); $email_message = "Une nouvelle commande vient d'être ajoutée <br/> \n Pour confirmer la receprion :<a href='" . base_url() . "orders/recieved/" . $key . "/" . $verif_code . "/'>" . base_url() . "orders/recieved/" . $key . "/" . $verif_code . "/ </a><br/>\n Pour confirmer le traitement :<a href='" . base_url() . "orders/submit/" . $key . "/" . $verif_code . "/'>" . base_url() . "orders/submit/" . $key . "/" . $verif_code . "/ </a><br/>\n Pour confirmer l'envoie :<a href='" . base_url() . "orders/send/" . $key . "/" . $verif_code . "/'>" . base_url() . "orders/send/" . $key . "/" . $verif_code . "/ </a>"; $mailer->MsgHTML($email_message); $mailer->AddAddress('*****@*****.**', 'Skander Jabouzi'); $mailer->Send(); } } redirect('wishlist/confirmation/'); } else { redirect('login/storelogin'); } }
function mailrestaurar($email, $passnew) { require_once '../mail/class.phpmailer.php'; require "../mail/class.smtp.php"; $mail = new phpmailer(); $mail->PluginDir = '../mail/'; $mail->SMTPSecure = "tls"; $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true; $mail->Username = "******"; $mail->Password = "******"; $mail->Port = 587; //puerto de autenticacion que usa gmail $mail->AddAddress($email); $mail->IsHTML = true; $mail->MsgHTML('Recuperacion de Password <br><br> Punto de Encuentro te envia el siguiente Password, para que puedas entrar a tu usuario<br><br>Password: '******'<br><br> Ingresa a este Link: http://proyectospi.com/PuntodeEncuentroP/html/pages/changepassword.php <br><br>para Ingresar a tu sesion con la Password que te enviamos en este correo.'); $mail->SetFrom("*****@*****.**", "Punto de Encuentro"); $mail > Subject == "Recuperacion de Password"; //indico destinatario $exito = $mail->Send(); if (!$exito) { echo "Error al enviar: " . $mail > ErrorInfo; } else { echo "Ok"; } }
$email = $dd['email']; $position = $dd['position']; $nits_rec1 = new phpmailer(); $nits_rec1->IsSMTP(); $nits_rec1->SMTPAuth = "true"; $nits_rec1->SMTPDebug = 2; $nits_rec1->IsHTML(true); $nits_rec1->SMTPAuth = true; $nits_rec1->Username = "******"; //to change email id from sending $nits_rec1->Password = "******"; //its password $nits_rec1->SMTPSecure = 'tls'; $nits_rec1->From = "*****@*****.**"; $nits_rec1->FromName = "NIT Silchar"; $nits_rec1->Subject = "Form submitted successfully."; $nits_rec1->Host = "172.16.30.72"; // HOST SMTP OUT ADDRESS $nits_rec1->Port = 587; $body = "<html><head><link href='http://www.nits.ac.in/css/style.css' rel='stylesheet' type='text/css'/><link href='http://www.nits.ac.in/nits_rec/css/recruitment_form.css' rel='stylesheet' type='text/css'/><link href='http://old.nits.ac.in/nits_rec/css/final_form.css' rel='stylesheet' type='text/css'/><link href='http://fonts.googleapis.com/css?family=Marcellus' rel='stylesheet' type='text/css'><link href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed' rel='stylesheet' type='text/css'></head><body><div id='wrapper' style='width:600px;'><div id='top' ><div id='logo' ><h1><a href='http://recruitment.nits.ac.in/non_faculty/index.php'>National Institute of Technology Silchar</a></h1></div></div>"; $body .= "THANK YOU for submitting your request for the position : " . $position . ", at National Institute of Technology, Silchar.<br /><br/><br/><b>Login & See your submitted form and print it out, <a href='http://recruitment.nits.ac.in/non_faculty/rlogin_a.php'>CLICK HERE</a></b></div></body>"; $nits_rec1->Mailer = "smtp"; $nits_rec1->Priority = '1'; $nits_rec1->MsgHTML($body); $nits_rec1->AltBody = "THANK YOU for submitting your request for the faculty position : " . $position . ", at National Institute of Technology, Silchar.Login & See your submitted form and print it out, http://recruitment.nits.ac.in/non_faculty/rlogin_a.php"; $nits_rec1->AddAddress($email); $nits_rec1->Encoding = "base64"; if (!$nits_rec1->Send()) { echo "There has been a mail error sending to " . $email . "<br/>Error info : " . $nits_rec->ErrorInfo; } header("location:show_form.php");
/** * Funcion que envia el correo * @param $to * @param $cc * @param $cco * @param $subject * @param $from * @param $body * Valida que los destinatarios con sus * respectivos nombres y asunto tengan * un formato válido. * * Se envia correo a los destinatarios recibidos * Retorna boolean true al enviar correo exitoso. * @return boolean */ public function Send($value = '') { $to = $this->to; // Cuenta que los destinatarios to no sean mas de 5. $contador = count($to); if ($contador > 5) { $this->errors = "MAX_FIVE_RECIPIENTS"; return 0; } // Se evoca la funcion validadora para comprobar // los formatos de correo y respectivos nombres. $t = $this->Valida_dest($to); if ($t == 0) { return 0; } $cc = $this->cc; // Cuenta que los destinatarios cc(si hubiese) no sean mas de 5. $contador = count($cc); if ($contador > 5) { $this->errors = "MAX_FIVE_COPYS"; return 0; } // Se evoca la funcion validadora para comprobar // los formatos de correo y respectivos nombres(si hubiese). $c = $this->Valida_dest($cc); if ($c == 0) { return 0; } $cco = $this->cco; // Cuenta que los destinatarios cco(si hubiese) no sean mas de 5. $contador = count($cco); if ($contador > 20) { $this->errors = "MAX_TWENTY_BCC"; return 0; } // Se evoca la funcion validadora para comprobar // los formatos de correo y respectivos nombres(si hubiese). $co = $this->Valida_dest($cco); if ($co == 0) { return 0; } $subject = $this->subject; // Se evoca la funcion validadora para comprobar // el formato del asunto. if (!empty($subject)) { $s = $this->Valida_headers($subject); if ($s == 0) { return 0; } foreach ($subject as $key => $value) { $subject = $value; } } $from = $this->from; if (!empty($from)) { // Se evoca la funcion validadora para comprobar // el formato del correo y nombre del remitente. $def_from = 1; $f = $this->Valida_headers($from); if ($f == 0) { return 0; } $from = array(); foreach ($f as $key => $value) { $from[] = $value; } } else { $def_from = 0; } $replyto = $this->replyto; if (!empty($replyto)) { $rp = 1; // Se evoca la funcion validadora para comprobar // el formato del correo y nombre para informar // sobre correos fallidos(si hubiese). $rt = $this->Valida_headers($replyto); if ($rt == 0) { return 0; } $replyto = array(); foreach ($rt as $key => $value) { $replyto[] = $value; } } else { $rp = 0; } $body = $this->body; // Recibimos las rutas y alias de los archivos adjuntos // necesarios a enviar en el correo (si hubiese). $attachment = $this->attachment; if (!empty($attachment)) { $z = 2; $attachment_r = array(); $attachment_t = array(); foreach (new ArrayIterator($this->attachment) as $route => $type) { $attachment_r[] = $route; $attachment_t[] = $type; } } else { $z = 1; } // Recibimos las rutas y alias de las imagenes embebidas en un html // necesarios a enviar en el correo (si hubiese). $embeddedimg = $this->embeddedimg; if (!empty($embeddedimg)) { $y = 2; $embeddedimg_r = array(); $embeddedimg_t = array(); foreach (new ArrayIterator($this->embeddedimg) as $route => $type) { $embeddedimg_r[] = $route; $embeddedimg_t[] = $type; } } else { $y = 1; } // si se deseára configurar los parametros de el dominio // y cuenta de correo default, aquí se recibirian los parámetros. $port = $this->port; $smtp_secure = $this->smtp_secure; $auth = $this->auth; $host = $this->host; $username = $this->username; $password = $this->password; $mail = new phpmailer(); $mail->CharSet = 'UTF-8'; $mail->Mailer = "smtp"; $mail->IsSMTP(); ini_set('max_execution_time', 600); $mail->SMTPAuth = true; // si se indica un puerto este se utilizara, // de lo contrario su usará el default. if (empty($port)) { $mail->Port = 465; } else { $mail->Port = $port; } // si se indica un tipo de seguridad este se utilizara, // de lo contrario su usará el default. if (empty($smtp_secure)) { $mail->SMTPSecure = 'ssl'; } else { $mail->SMTPSecure = $smtp_secure; } // si se indica un cambio en la autenticación este se utilizara, // de lo contrario su usará el default. if (empty($auth)) { $mail->SMTPAuth = true; } else { $mail->SMTPAuth = $auth; } // si se indica un host este se utilizara, // de lo contrario su usará el default. if (empty($host)) { $mail->Host = "securemail.aplus.net"; } else { $mail->Host = $host; } // si se indica un usuario este se utilizara, // de lo contrario su usará el default. if (empty($username)) { $mail->Username = "******"; } else { $mail->Username = $username; } // si se indica un password este se utilizara, // de lo contrario su usará el default. if (empty($password)) { $mail->Password = "******"; } else { $mail->Password = $password; } $mail->Subject = $subject; if ($def_from == 1) { $mail->SetFrom($from[1], $from[0]); } else { $mail->SetFrom('*****@*****.**', 'Global Corporation'); } if ($rp == 1) { $mail->AddReplyTo($replyto[1], $replyto[0]); } $mail->Body = " "; $mail->MsgHTML($body); if ($z == 2) { for ($a = 0; $a < count($attachment_r); $a++) { $mail->AddAttachment($attachment_r[$a], $attachment_t[$a]); } } if ($y == 2) { for ($a = 0; $a < count($embeddedimg_r); $a++) { $mail->AddEmbeddedImage($embeddedimg_r[$a], $embeddedimg_t[$a]); } } for ($i = 0; $i < count($to); $i++) { $a = $to[$i]; $mail->AddAddress($a['direccion'], $a['nombre']); } for ($j = 0; $j < count($cc); $j++) { $a = $cc[$j]; $mail->AddCC($a['direccion'], $a['nombre']); } for ($k = 0; $k < count($cco); $k++) { $a = $cco[$k]; $mail->AddBCC($a['direccion'], $a['nombre']); } $mail->IsHTML(true); if ($mail->Send()) { return true; } else { $this->errors = "SEND_MAIL_ERROR " . $mail->ErrorInfo; return 0; } }
function request_cancel($order_id) { $order_status = $this->status_model->get($order_id); $problems = $_POST['problems']; $mailer = new phpmailer(); $mailer->IsSendmail(); $mailer->From = '*****@*****.**'; $mailer->FromName = 'Belron admin'; $mailer->Subject = utf8_decode('Demande pour annuler pour une demande'); $email_message = "Une demande pour annuler une demande : <br/><br/>"; foreach ($problems as $problem) { $email_message .= $problem . "<br/>"; } $email_message .= "Pour confirmer l'annulation :<a href='" . base_url() . "orders/cancel/" . $order_id . "/" . $order_status[0]->code_verif . "/'>" . base_url() . "orders/cancel/" . $order_id . "/" . $order_status[0]->code_verif . "/ </a><br/>"; $mailer->MsgHTML($email_message); $mailer->AddAddress('*****@*****.**', 'Skander Jabouzi'); $mailer->Send(); redirect('orders/request_confirmation'); }
function request_price() { $mailer = new phpmailer(); $mailer->IsSendmail(); $mailer->From = '*****@*****.**'; $mailer->FromName = 'Belron admin'; $mailer->Subject = utf8_decode('Demande pour pour revision de prix : #') . $_POST['id']; $email_message = "Une demande pour revision de prix : #{$_POST['id']}<br/><br/>"; foreach ($problems as $problem) { $email_message .= $_POST['price_request'] . "<br/>"; } $email_message .= "La page du produit : <a href='" . base_url() . "productsmanager/edit/" . $_POST['id'] . "/'>" . base_url() . "productsmanager/edit/" . $_POST['id'] . "/ </a><br/>"; $mailer->MsgHTML($email_message); $mailer->AddAddress('*****@*****.**', 'Skander Jabouzi'); $mailer->Send(); redirect('orders/request_confirmation'); }
* @param string mailto address * @param string mail content * @param array word replace rules * */ public static function autosend($mailto, $content, $replace = null) { foreach ($replace as $k => $v) { $content = str_replace($k, $v, $content); } $to = array(); if (is_string($mailto)) { $to[0] = $mailto; } assert(trim($mailto) == ''); Mail::_send($to, $content); } /** * Basic send function. * @param array mailto list * @param string content * @param array attachment path list */ private static function _send($mailto, $content, $title = '', $attachment = null) { require_once 'phpmailer/class.phpmailer.php'; #echo "Begin!<br/>"; if ($title == '') { $title = '来自IBM Power大赛官方的自动邮件,请勿直接回复本邮件。'; } $mail = new phpmailer(); // defaults to using php "mail()" $mail->IsSmtp(); // telling the class to use SendMail transport #$body = 'hello cxj!<br/>'; #$body = eregi_replace("[\]",'',$body); $config = C('PHPMAILER'); $address = $config['FROM']; $password = $config['PASSWORD']; $smtp = $config['HOST']; $port = $config['PORT']; #$mail->AddReplyTo($address,"First Last"); foreach ($mailto as $m) { $mail->AddAddress($m, "Power大赛参赛选手 {$m} "); } $mail->SMTPAuth = true; //$mail->from = $address; //$mail->to = $address; $mail->smtpsecure = 'ssl'; $mail->From = $address;