function sendMail($correoUsuario, $correoCliente, $archivo) { $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Host = SMTP; $mail->SMTPSecure = SSL; $mail->Username = USERNAME; $mail->Password = PASSWORDSMTP; $mail->CharSet = "UTF-8"; $mail->Port = PORT; $mail->From = FROM; $mail->FromName = FROMNAME; $mail->Subject = 'Propuesta Comercial Voy'; $mail->WordWrap = WORDWRAP; $mail->IsHTML(true); $mail->MsgHTML($this->bodyMailTable()); $mail->AddReplyTo(FROM, FROMNAME); $mail->AddAttachment('folder/' . $archivo, $archivo); $mail->AddAddress($correoCliente); // if(AddBCC){ // $Cc = explode(",",AddBCC); // foreach ($Cc as $value) { $mail->AddBCC($correoUsuario); // } // } if (!$mail->Send()) { echo "Error de envío de email: " . $mail->ErrorInfo; exit; } else { return; } }
function enviar() { if ($this->cliente->getAccessToken()) { $service = new Google_Service_Gmail($this->cliente); try { $mail = new PHPMailer(); $mail->CharSet = "UTF-8"; $mail->From = Contants::FROM; $mail->FromName = Contants::ALIAS; $mail->AddAddress($this->destino); $mail->AddReplyTo(Contants::FROM, Contants::ALIAS); $mail->Subject = $this->asunto; $mail->Body = $this->mensaje; $mail->preSend(); $mime = $mail->getSentMIMEMessage(); $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '='); $mensaje = new Google_Service_Gmail_Message(); $mensaje->setRaw($mime); $service->users_messages->send('me', $mensaje); $r = 1; } catch (Exception $e) { print $e->getMessage(); $r = 0; } } else { $r = -1; } return $r; }
function wpsight_mail_send_email($data = array(), $opts = array()) { if (!class_exists('PHPMailer')) { require ABSPATH . '/wp-includes/class-phpmailer.php'; } $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; foreach ($data['recipients'] as $addr) { if (is_array($addr)) { $mail->AddAddress($addr[0], $addr[1]); } else { $mail->AddAddress($addr); } } $mail->Subject = isset($data['subject']) ? $data['subject'] : null; if (is_array($data['body']) && isset($data['body']['html'])) { $mail->isHTML(true); $mail->Body = $data['body']['html']; $mail->AltBody = isset($data['body']['text']) ? $data['body']['text'] : null; } $mail->From = $data['sender_email']; $mail->FromName = $data['sender_name']; if (isset($data['reply_to'])) { foreach ((array) $data['reply_to'] as $addr) { if (is_array($addr)) { $mail->AddReplyTo($addr[0], $addr[1]); } else { $mail->AddReplyTo($addr); } } } if (isset($data['attachments']) && is_array($data['attachments'])) { foreach ($data['attachments'] as $attachment) { $encoding = isset($attachment['encoding']) ? $attachment['encoding'] : 'base64'; $type = isset($attachment['type']) ? $attachment['type'] : 'application/octet-stream'; $mail->AddStringAttachment($attachment['data'], $attachment['filename'], $encoding, $type); } } if (isset($opts['transport']) && $opts['transport'] == 'smtp') { $mail->isSMTP(); $mail->Host = $opts['smtp_host']; $mail->Port = isset($opts['smtp_port']) ? (int) $opts['smtp_port'] : 25; if (!empty($opts['smtp_user'])) { $mail->Username = $opts['smtp_user']; $mail->Password = $opts['smtp_pass']; } if (!empty($opts['smtp_sec'])) { $mail->SMTPSecure = $opts['smtp_sec']; } } do_action('wpsight_mail_pre_send', $mail, $data, $opts); return $mail->send() ? true : $mail->ErrorInfo; }
public function handle($fromTitle, $fromMail, $toEmail, $subject, $body, $attachments, $smtpHost, $smtpPort, $serverLogin = '', $serverPassword = '', $charCode = 'UTF-8', $isHtml = false) { if (!is_object($this->_mail)) { $this->_mail = new PHPMailer(); } $this->_mail->CharSet = $charCode; $this->_mail->IsHTML($isHtml); $this->_mail->From = $fromMail; $this->_mail->FromName = $fromTitle; $this->_mail->AddReplyTo($fromMail, $fromTitle); $this->_mail->Subject = $subject; $this->_mail->Body = $body; $this->_mail->AltBody = ''; $this->_mail->AddAddress($toEmail, ''); $this->_mail->IsSMTP(true); $this->_mail->Mailer = 'smtp'; $this->_mail->Host = $smtpHost; $this->_mail->Port = $smtpPort; if ($serverLogin != '') { $this->_mail->SMTPAuth = true; $this->_mail->Username = $serverLogin; $this->_mail->Password = $serverPassword; } else { $this->_mail->SMTPAuth = false; $this->_mail->Username = ''; $this->_mail->Password = ''; } if (is_object($attachments)) { //FIXME // // zalaczniki //for ($z = 0; $z < Count($tab_mail_oma_zalacznik[$tab_mail_id[$i]]); $z++) { //if (($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z] != '') AND (file_exists($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]))) { //if ($tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] == '') { //$this->_mail->AddAttachment($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], basename($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z])); //} // koniec if... //else { //$this->_mail->AddEmbeddedImage($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z]); //$tmp_tresc = str_replace('[' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] . ']', 'cid:' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z], $tmp_tresc); //} // koniec else... //} // koniec if... //} // koniec for... } if (!$this->_mail->Send()) { $status = false; } else { $status = true; } $this->_mail->ClearAddresses(); $this->_mail->ClearAttachments(); return $status; }
/** * Método para carregar o objeto PHPMailer * @return \PHPMailer */ public function carregar() { $dados = \controlador\Facil::getDadosIni(); require(LIB . DS . "PHPMailer/class.phpmailer.php"); $this->mailer = new \PHPMailer(); if ($dados['email']['smtp']) { $this->mailer->IsSMTP(); $this->mailer->Host = $dados['email']['host']; $this->mailer->SMTPAuth = $dados['email']['autenticar']; $this->mailer->Username = $dados['email']['usuario']; $this->mailer->Password = $dados['email']['senha']; } $this->mailer->From = $dados['email']['from_email']; $this->mailer->FromName = $dados['email']['from_nome']; $this->mailer->IsHTML($dados['email']['html']); $this->mailer->WordWrap = $dados['email']['wordwrap']; $this->mailer->AddReplyTo($this->mailer->From); $this->mailer->CharSet = $dados['l10n']['charset']; return $this->mailer; }
function send_mail($to, $subject, $content, $addreply = null, $attach = false) { require_once 'config.php'; require_once 'class.phpmailer.php'; $mail = new PHPMailer(true); $mail->IsSMTP(); try { $mail->Host = $__smtp['host']; $mail->SMTPDebug = $__smtp['debug']; $mail->SMTPAuth = $__smtp['auth']; $mail->Host = $__smtp['host']; $mail->Port = $__smtp['port']; $mail->Username = $__smtp['username']; $mail->Password = $__smtp['password']; $mail->AddAddress($to); $mail->SetFrom($__smtp['username'], $__smtp['fromname']); if (!empty($addreply)) { $mail->AddReplyTo($addreply, $addreply); } else { $mail->AddReplyTo($__smtp['addreply'], $__smtp['fromname']); } $mail->Subject = htmlspecialchars($subject); $mail->MsgHTML($content); if ($attach) { $mail->AddAttachment($attach); } return $mail->Send(); } catch (phpmailerException $e) { //echo $e->errorMessage(); return false; } catch (Exception $e) { //echo $e->getMessage(); return false; } }
/** * Short description of method send * * @access public * @author Bertrand Chevrier, <*****@*****.**> * @return int */ public function send() { $returnValue = (int) 0; foreach ($this->messages as $message) { if ($message instanceof tao_helpers_transfert_Message) { $this->mailer->SetFrom($message->getFrom()); $this->mailer->AddReplyTo($message->getFrom()); $this->mailer->Subject = $message->getTitle(); $this->mailer->AltBody = strip_tags(preg_replace("/<br.*>/i", "\n", $message->getBody())); $this->mailer->MsgHTML($message->getBody()); $this->mailer->AddAddress($message->getTo()); try { if ($this->mailer->Send()) { $message->setStatus(tao_helpers_transfert_Message::STATUS_SENT); $returnValue++; } if ($this->mailer->IsError()) { if (DEBUG_MODE) { echo $this->mailer->ErrorInfo . "<br>"; } $message->setStatus(tao_helpers_transfert_Message::STATUS_ERROR); } } catch (phpmailerException $pe) { if (DEBUG_MODE) { print $pe; } } } $this->mailer->ClearReplyTos(); $this->mailer->ClearAllRecipients(); } $this->mailer->SmtpClose(); return (int) $returnValue; }
public static function send($to, $subject, $content) { $__smtp = array("host" => "smtp.sxss.com.ua", "debug" => 0, "auth" => true, "port" => 25, "username" => "*****@*****.**", "password" => "oz7UQD1a", "addreply" => "*****@*****.**", "replyto" => ""); $mail = new PHPMailer(true); $mail->IsSMTP(); try { $mail->CharSet = 'utf-8'; $mail->Host = $__smtp['host']; $mail->SMTPDebug = $__smtp['debug']; $mail->SMTPAuth = $__smtp['auth']; $mail->Host = $__smtp['host']; $mail->Port = $__smtp['port']; $mail->Username = $__smtp['username']; $mail->Password = $__smtp['password']; $mail->AddReplyTo($__smtp['username'], "ClickPay24"); $mail->AddAddress($to); $mail->SetFrom($__smtp['username'], "ClickPay24"); $mail->AddReplyTo($__smtp['username'], "ClickPay24"); $mail->Subject = htmlspecialchars($subject); $mail->MsgHTML($content); $mail->Send(); } catch (phpmailerException $e) { } catch (Exception $e) { } }
function send($o, $to, $from, $subject, $body, $headers) { $mail = new PHPMailer(true); $mail->IsSMTP(); $mail->SMTPDebug = 0; // enables SMTP debug information (for testing) $mail->SMTPAuth = $this->api->getConfig("tmail/phpmailer/username", null) ? true : false; // enable SMTP authentication $mail->Host = $this->api->getConfig("tmail/smtp/host"); $mail->Port = $this->api->getConfig("tmail/smtp/port"); $mail->Username = $this->api->getConfig("tmail/phpmailer/username", null); $mail->Password = $this->api->getConfig("tmail/phpmailer/password", null); $mail->SMTPSecure = 'tls'; $mail->AddReplyTo($this->api->getConfig("tmail/phpmailer/reply_to"), $this->api->getConfig("tmail/phpmailer/reply_to_name")); $mail->AddAddress($to); $mail->Subject = $subject; $mail->MsgHTML($body); $mail->AltBody = null; $mail->IsHTML(true); $bcc = $this->api->getConfig("tmail/phpmailer/bcc", null); if ($bcc) { $bcc_name = $this->api->getConfig("tmail/phpmailer/bcc_name", null); $mail->AddBCC($bcc, $bcc_name); } $internal_header_map = array("Content-Type" => "ContentType"); $void_headers = array("MIME-Version"); $fromAdded = false; foreach (explode("\n", $headers) as $h) { if (preg_match("/^(.*?):(.*)\$/", $h, $t)) { if (strtolower($t[1]) == "from" && $t[2]) { $mail->SetFrom($t[2]); $fromAdded = true; continue; } if (isset($internal_header_map[$t[1]])) { $key = $internal_header_map[$t[1]]; $mail->{$key} = $t[2]; continue; } else { if (in_array($t[1], $void_headers)) { continue; } } } $mail->AddCustomHeader($h); } if (!$fromAdded) { $mail->SetFrom($this->api->getConfig("tmail/phpmailer/from"), $from ? "" : $this->api->getConfig("tmail/phpmailer/from_name")); $mail->AddReplyTo($this->api->getConfig("tmail/phpmailer/reply_to"), $this->api->getConfig("tmail/phpmailer/reply_to_name")); } $mail->Send(); }
/** * Run before each test is started. */ function setUp() { if (file_exists('./testbootstrap.php')) { include './testbootstrap.php'; //Overrides go in here } require_once $this->INCLUDE_DIR . 'class.phpmailer.php'; $this->Mail = new PHPMailer(); $this->Mail->Priority = 3; $this->Mail->Encoding = "8bit"; $this->Mail->CharSet = "iso-8859-1"; if (array_key_exists('mail_from', $_REQUEST)) { $this->Mail->From = $_REQUEST['mail_from']; } else { $this->Mail->From = '*****@*****.**'; } $this->Mail->FromName = "Unit Tester"; $this->Mail->Sender = ""; $this->Mail->Subject = "Unit Test"; $this->Mail->Body = ""; $this->Mail->AltBody = ""; $this->Mail->WordWrap = 0; if (array_key_exists('mail_host', $_REQUEST)) { $this->Mail->Host = $_REQUEST['mail_host']; } else { $this->Mail->Host = 'mail.example.com'; } if (array_key_exists('mail_port', $_REQUEST)) { $this->Mail->Port = $_REQUEST['mail_port']; } else { $this->Mail->Port = 25; } $this->Mail->Helo = "localhost.localdomain"; $this->Mail->SMTPAuth = false; $this->Mail->Username = ""; $this->Mail->Password = ""; $this->Mail->PluginDir = $this->INCLUDE_DIR; $this->Mail->AddReplyTo("*****@*****.**", "Reply Guy"); $this->Mail->Sender = "*****@*****.**"; if (strlen($this->Mail->Host) > 0) { $this->Mail->Mailer = "smtp"; } else { $this->Mail->Mailer = "mail"; $this->Mail->Sender = "*****@*****.**"; } if (array_key_exists('mail_to', $_REQUEST)) { $this->SetAddress($_REQUEST['mail_to'], 'Test User', 'to'); } if (array_key_exists('mail_cc', $_REQUEST) and strlen($_REQUEST['mail_cc']) > 0) { $this->SetAddress($_REQUEST['mail_cc'], 'Carbon User', 'cc'); } }
function Sendemail($to, $subject, $message, $repyto, $from, $fromname) { try { $mail = new PHPMailer(true); //New instance, with exceptions enabled $mail->IsSMTP(); // tell the class to use SMTP $mail->SMTPAuth = false; // enable SMTP authentication $mail->IsSendmail(); // tell the class to use Sendmail $mail->AddReplyTo($repyto, $fromname); $mail->From = $from; $mail->FromName = $fromname; $mail->AddAddress($to); $mail->Subject = $subject; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->WordWrap = 80; // set word wrap $mail->MsgHTML($message); $mail->IsHTML(true); // send as HTML $mail->Send(); return true; } catch (phpmailerException $e) { //echo $e->errorMessage(); } }
function Send_Mail($to, $subject, $body) { require 'class.phpmailer.php'; $from = "*****@*****.**"; $mail = new PHPMailer(); $mail->IsSMTP(true); // SMTP $mail->SMTPAuth = true; // SMTP authentication $mail->Mailer = "smtp"; $mail->Host = "tls://smtp.gmail.com"; // Amazon SES server, note "tls://" protocol $mail->Port = 465; // set the SMTP port $mail->Username = "******"; // SES SMTP username $mail->Password = "******"; // SES SMTP password $mail->SetFrom($from, 'ENQUIP'); $mail->AddReplyTo($from, 'sushantjadhav2010'); $mail->Subject = $subject; $mail->MsgHTML($body); $address = $to; $mail->AddAddress($address, $to); if (!$mail->Send()) { return false; } else { return true; } }
function sendEmail($email,$subjectMail,$bodyMail,$email_back){ $mail = new PHPMailer(true); $mail->IsSMTP(); // telling the class to use SMTP try { //$mail->Host = SMTP_HOST; // SMTP server $mail->SMTPDebug = 0; // enables SMTP debug information (for testing) $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = SMTP_HOST; // sets the SMTP server $mail->Port = SMTP_PORT; // set the SMTP port for the GMAIL server $mail->Username = SMTP_USER; // SMTP account username $mail->Password = SMTP_PASSWORD; // SMTP account password $mail->AddAddress($email, ''); // SMTP account password $mail->SetFrom(SMTP_EMAIL, SMTP_NAME); $mail->AddReplyTo($email_back, SMTP_NAME); $mail->Subject = $subjectMail; $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automaticall//y $mail->MsgHTML($bodyMail) ; if(!$mail->Send()){ $success='0'; $msg="Error in sending mail"; }else{ $success='1'; } } catch (phpmailerException $e) { $msg=$e->errorMessage(); //Pretty error messages from PHPMailer } catch (Exception $e) { $msg=$e->getMessage(); //Boring error messages from anything else! } //echo $msg; }
function smtpmail($to, $subject, $content, $attach = false) { require_once 'config_app.php'; require_once 'phpmailer/class.phpmailer.php'; $mail = new PHPMailer(true); $mail->IsSMTP(); $mail->Host = $__smtp['host']; $mail->SMTPDebug = $__smtp['debug']; $mail->SMTPAuth = $__smtp['auth']; $mail->Host = $__smtp['host']; $mail->Port = $__smtp['port']; $mail->Username = $__smtp['username']; $mail->Password = $__smtp['password']; $mail->SetFrom($__smtp['addreply'], 'Mashkov Andrey'); $mail->AddReplyTo($__smtp['addreply'], $__smtp['username']); $mail->AddAddress($to); $mail->Subject = htmlspecialchars($subject); $mail->CharSet = 'utf8'; $mail->MsgHTML($content); if ($attach) { $mail->AddAttachment($attach); } if (!$mail->Send()) { $returner = "errorSend"; } else { $returner = "okSend"; } $mail->ClearAddresses(); $mail->ClearAttachments(); $mail->IsHTML(true); return $returner; }
/** * * Can be used to add various types of address * * @param string $type * @param $address * @param string $name * @throws \InvalidArgumentException * @return $this * @author Tim Perry */ public function addAddress($type, $address, $name = '') { if (empty($address) || filter_var($address, FILTER_VALIDATE_EMAIL) === false) { $message = "Invalid address please provide a valid email address"; throw new \InvalidArgumentException($message); } switch ($type) { default: case 'to': $this->mailer->AddAddress($address, $name); break; case 'from': $this->mailer->SetFrom($address, $name); break; case 'bcc': $this->mailer->AddBCC($address, $name); break; case 'cc': $this->mailer->AddCC($address, $name); break; case 'replyto': $this->mailer->AddReplyTo($address, $name); break; } return $this; }
public function login() { $uid = $this->session->user->id; $token = md5(date('Ymd') . $this->session->user->id . $this->session->user->login . $this->session->user->login . 'HAHAAHAVOACABARCOMISSOJAJA'); $v = new Views(); $v->username = $this->session->user->login; $v->link = HOST . "meu-perfil/redes-sociais/nerdtrack/callback/?uid={$uid}&token={$token}"; $message = $v->render('mail/nerdtrack-link-account.phtml'); Phalanx::loadExtension('phpmailer'); $mail = new PHPMailer(true); $mail->IsSMTP(); $mail_status = true; try { $mail->AddReplyTo(MAIL_FROM, MAIL_ALIAS); $mail->AddAddress($this->post->email_address, $this->session->user->login); $mail->Subject = 'SkyNerd: Vínculo de conta da Nerdtrack'; $mail->MsgHTML($message); $mail->Send(); } catch (phpmailerException $e) { $mail_status = false; } header("Content-type: text/html; charset=utf-8"); if ($mail_status) { Phalanx::loadClasses('SocialNetwork'); SocialNetwork::link_account($this->session->user->id, NERDTRACK, $this->post->email_address, false); die('SUCCESS'); } else { die('FAIL'); } }
/** * @param $data * @return bool|string * @throws Exception * @throws phpmailerException */ public static function send($data) { $mail = new PHPMailer(); if (cfg()->is_smtp) { $mail->IsSMTP(); // set mailer to use SMTP } $mail->Host = cfg()->smtp_host; $mail->Port = cfg()->smtp_port; $mail->SMTPAuth = cfg()->smtp_auth; // turn on SMTP authentication $mail->Username = cfg()->mail_user; // SMTP username $mail->Password = cfg()->mail_password; // SMTP password $mail->From = $data['from_email']; $mail->FromName = $data['from_name']; $mail->AddAddress($data['to_mail']); $mail->SetFrom($data['from_email'], $data['from_name']); $mail->AddReplyTo($data['from_email'], $data['from_name']); //$mail->SMTPDebug = 10; //$mail->SMTPSecure = 'tls'; $mail->WordWrap = cfg()->mail_world_warp; // set word wrap to 50 characters $mail->IsHTML(cfg()->is_html); // set email format to HTML $mail->Subject = $data['subject']; $mail->Body = $data['message_html']; if (!$mail->Send()) { return $mail->ErrorInfo; } return true; }
/** * Send an email notification to a user * * @static * @since 1.1.0 * @param string $user_id User object_id * @param string $subject Email subject line * @param string $message Email body */ public static function notify_user($user_id, $subject, $message, $short_text = null) { $error = new argent_error(); if (!class_exists('PHPMailer')) { $error->add('1042', 'PHPMailer is not available', NULL, 'argent_notification'); } if ($error->has_errors()) { return $error; } $mail = new PHPMailer(); $mail->AddReplyTo(NOTIFICATION_FROM_MAIL, NOTIFICATION_FROM_NAME); $mail->SetFrom(NOTIFICATION_FROM_MAIL, NOTIFICATION_FROM_NAME); $user_data = argent_uauth::user_get_data($user_id); if (argent_error::check($user_data)) { return $user_data; } $mail->AddAddress($user_data['email'], $user_data['display_name']); $mail->Subject = $subject; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $merge_fields = array('user_name' => $user_data['display_name'], 'email' => $user_data['email'], 'body' => $message, 'subject' => $subject, 'intro' => $short_text); $message_body = self::merge_template(ABSOLUTE_PATH . 'argent/html_email_templates/basic.html', $merge_fields); if (argent_error::check($message_body)) { return $message_body; } $mail->MsgHTML($message_body); if (!$mail->Send()) { $error->add('1040', 'Error sending mail', $mail->ErrorInfo, 'argent_notification'); return $error; } else { return 'Mail sent to ' . $user_data['email']; } }
function Send_Mail($to, $subject, $body) { require 'class.phpmailer.php'; $from = "*****@*****.**"; $mail = new PHPMailer(); $mail->IsSMTP(true); // SMTP $mail->SMTPAuth = true; // SMTP authentication $mail->Mailer = "smtp"; $mail->Host = "tls://email-smtp.us-east.amazonaws.com"; // Amazon SES $mail->Port = 465; // SMTP Port $mail->Username = "******"; // SMTP Username $mail->Password = "******"; // SMTP Password $mail->SetFrom($from, 'From Name'); $mail->AddReplyTo($from, '9lessons Labs'); $mail->Subject = $subject; $mail->MsgHTML($body); $address = $to; $mail->AddAddress($address, $to); }
function send_gmail($from_email, $from_email_pass, $to_email, $subject, $content, $from_name = '') { $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "smtp.gmail.com"; // specify main and backup server $mail->Port = 465; // set the port to use $mail->SMTPAuth = true; // turn on SMTP authentication $mail->SMTPSecure = 'ssl '; $mail->Username = $from_email; // your SMTP username or your gmail username $mail->Password = $from_email_pass; // your SMTP password or your gmail password $mail->From = $from_email; $mail->FromName = $from_name; // Name to indicate where the email came from when the recepient received $mail->AddAddress($to_email, $to_name); $mail->AddReplyTo($from_email, $from_name); $mail->WordWrap = 50; // set word wrap $mail->IsHTML(true); // send as HTML $mail->Subject = $subject; $mail->Body = $content; //HTML Body $mail->CharSet = 'UTF-8'; return $mail->Send(); }
function notificaciones_email($emailEnv, $nombre) { $mail = new PHPMailer(); $email = "*****@*****.**"; // Recipients email ID $name = " Sanco Business RH "; // Recipient's name $mail->From = $emailEnv; $mail->FromName = "Sanco Business Manager"; $mail->AddAddress($email, $name); $mail->AddReplyTo("No-reply"); $mail->WordWrap = 50; // set word wrap $mail->IsHTML(true); // send as HTML $mail->Subject = "Registro de nuevo usuario"; $mail->Body = "Se registro un nuevo usurio, Correo: " . $emailEnv . " Nombre:" . $nombre . ""; //HTML Body $mail->AltBody = "This is the body when user views in plain text format"; //Text Body if (!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; header('Location:../nuevorep.php'); } //return $email; }
function Send_Mail($to, $subject, $body) { require 'class.phpmailer.php'; $from = "*****@*****.**"; $mail = new PHPMailer(); $mail->IsSMTP(true); // use SMTP $mail->IsHTML(true); $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "smtp.mandrillapp.com"; // Mandrillapp.com SES server, note "tls://" protocol $mail->Port = 587; // set the SMTP port $mail->Username = "******"; // SMTP username $mail->Password = "******"; // SMTP password $mail->SetFrom($from, 'ISA Website'); $mail->AddReplyTo($from, 'ISA Website'); $mail->Subject = $subject; $mail->MsgHTML($body); $address = $to; $mail->AddAddress($address, $to); $mail->Send(); }
function sendMailToTeacher($tea_email, $stu_question, $tea_name) { header("content-type:text/html;charset=utf-8"); ini_set("magic_quotes_runtime", 0); require 'class.phpmailer.php'; try { $mail = new PHPMailer(true); $mail -> IsSMTP(); $mail -> CharSet = 'UTF-8'; //设置邮件的字符编码,这很重要,不然中文乱码 $mail -> SMTPAuth = true; //开启认证 $mail -> Port = 25; $mail -> Host = "smtp.163.com"; $mail -> Username = "******"; $mail -> Password = "******"; //$mail->IsSendmail(); //如果没有sendmail组件就注释掉,否则出现“Could not execute: /var/qmail/bin/sendmail ”的错误提示 $mail -> AddReplyTo("*****@*****.**", "计算机科学答疑系统"); //回复地址 $mail -> From = "*****@*****.**"; $mail -> FromName = "计算机科学答疑系统"; $to = $tea_email; $mail -> AddAddress($to); $mail -> Subject = "您有一个新的问题待解答"; $mail -> Body = $tea_name . " 您好!有学生提出了新的问题: ".$stu_question." ,请回答!"; $mail -> AltBody = $tea_name . " 您好!有学生提出了新的问题: ".$stu_question." ,请回答!"; //当邮件不支持html时备用显示,可以省略 $mail -> WordWrap = 80; // 设置每行字符串的长度 //$mail->AddAttachment("f:/test.png"); //可以添加附件 $mail -> IsHTML(true); $mail -> Send(); } catch (phpmailerException $e) { echo "邮件发送失败:" . $e -> errorMessage(); } }
function email($contas) { global $CONFIG_smtp_server, $CONFIG_smtp_port, $CONFIG_smtp_username, $CONFIG_smtp_password, $CONFIG_smtp_mail, $CONFIG_name; $mensagem = "----------------------------\n"; for ($i = 0; isset($contas[$i][0]); $i++) { $mensagem .= "Username: "******"\nPassword: "******"\n----------------------------\n"; } $maildef = read_maildef("recover_password"); $maildef = str_ireplace("#account_info#", $mensagem, $maildef); $maildef = str_ireplace("#server_name#", $CONFIG_name, $maildef); $maildef = str_ireplace("#support_mail#", $CONFIG_smtp_mail, $maildef); $maildef = nl2br($maildef); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Host = $CONFIG_smtp_server; $mail->Port = $CONFIG_smtp_port; $mail->Username = $CONFIG_smtp_username; $mail->Password = $CONFIG_smtp_password; $mail->From = $CONFIG_smtp_mail; $mail->FromName = $CONFIG_name; $mail->Subject = "Password Recovery"; $mail->Body = $maildef; $mail->WordWrap = 50; $mail->AddAddress($contas[0][2], $contas[0][2]); $mail->AddReplyTo($CONFIG_smtp_mail, $CONFIG_name); $mail->IsHTML(true); if (!$mail->Send()) { return $mail->ErrorInfo; } else { return "Message has been sent"; } }
function Send_Mail($to, $subject, $body) { require 'class.phpmailer.php'; $from = "*****@*****.**"; $mail = new PHPMailer(); $mail->IsSMTP(true); // use SMTP $mail->IsHTML(true); $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "tls://smtp.gmail.com"; // Amazon SES server, note "tls://" protocol $mail->Port = 465; // set the SMTP port $mail->Username = "******"; // SMTP username $mail->Password = "******"; // SMTP password $mail->SetFrom($from, 'HELLO'); $mail->AddReplyTo($from, 'Reply'); //$mail->Body= "kiểm tra email bạn nhé"; //$mail->AltBody = "Bạn sao vậy Tí"; $mail->Subject = $subject; $mail->MsgHTML($body); $address = $to; $mail->AddAddress($address, $to); $mail->Send(); }
function Send_Mail($to, $subject, $body) { require './class.phpmailer.php'; $from = "*****@*****.**"; $mail = new PHPMailer(); $mail->IsSMTP(true); // SMTP $mail->SMTPAuth = true; // SMTP authentication $mail->Mailer = "smtp"; $mail->Host = "mail.privateemail.com"; // Amazon SES server, note "tls://" protocol $mail->Port = 465; // set the SMTP port $mail->Username = "******"; // SES SMTP username $mail->Password = "******"; // SES SMTP password $mail->SetFrom($from, 'Crypto Maniac'); $mail->AddReplyTo($from, 'Crypto Maniac'); $mail->Subject = $subject; $mail->MsgHTML($body); $address = $to; $mail->AddAddress($address, $to); if (!$mail->Send()) { return false; } else { return true; } }
function send_emailMailer($recipient, $sender, $name, $subject, $message) { //require_once("PHPMailer/class.phpmailer.php"); include "PHPMailer/class.phpmailer.php"; include "PHPMailer/class.smtp.php"; $CI =& get_instance(); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = $CI->config->item('smtp_host'); // sets the SMTP server $mail->Port = 25; // set the SMTP port for the GMAIL server $mail->Username = $CI->config->item('smtp_username'); // SMTP account username $mail->Password = $CI->config->item('smtp_password'); // SMTP account password $mail->SetFrom($sender, $name); $mail->AddReplyTo($sender, $name); $mail->Subject = $subject; $mail->AltBody = "Reset email"; // optional, comment out and test $mail->MsgHTML($message); $mail->AddAddress($recipient, ''); if (!$mail->Send()) { return array("error" => "Mailer Error: " . $mail->ErrorInfo); } else { return true; } }
function form() { if ($this->request->data) { $this->loadModel(CONTACT); $mail = new PHPMailer(); $mail->From = $this->request->data->mail; $mail->FromName = $this->request->data->name; $message = $this->request->data->content; if ($this->request->data->sendcopy == 1) { $mail->AddAddress($this->request->data->mail); $message .= "<div><div dir=\"ltr\"><div><span style=\"color:rgb(11,83,148)\">Bien à vous,<i><b><br></b></span></span></div><div><span style=\"color:rgb(11,83,148)\"><i><b><br>WebPassions</b><br></span></span></div><div><span style=\"color:rgb(11,83,148)\">Lorge Vivian<br></span></div><div><span style=\"color:rgb(11,83,148)\"><i>0479/95.98.45</span><br></span></div><span style=\"color:rgb(11,83,148)\"><a target=\"_blank\" href=\"http://www.webpassions.be\"><i>http://www.webpassions.be</span></a></span><br><div><br><div><img width=\"96\" height=\"28\" src=\"http://www.webpassions.be/signature.png\"><br><br><br></div></div></div></div>"; } $mail->IsHTML(true); $mail->CharSet = 'UTF-8'; $mail->AddAddress($_SESSION['cmscontact']); $mail->AddReplyTo($_SESSION['cmscontact']); $mail->Subject = $_SESSION['cmscontactcategory'][$this->request->data->subject]; $mail->Body = $message; if (!$mail->Send()) { $this->logger->LogError($this->request->controller, $this->request->action, $_SESSION[USER]->login, BackendTranslate::getLabel('send_error') . $mail->ErrorInfo); $this->Session->setAlert(BackendTranslate::getLabel('send_error') . $mail->ErrorInfo, DANGER); } else { $this->logger->LogInfo($this->request->controller, $this->request->action, $_SESSION[USER]->login, BackendTranslate::getLabel('send_mail')); $this->Session->setAlert(BackendTranslate::getLabel('send_mail'), SUCCESS); } unset($mail); } }
function Send_Mail($to, $subject, $body) { require 'class.phpmailer.php'; $from = "*****@*****.**"; $mail = new PHPMailer(); $mail->IsSMTP(true); // use SMTP $mail->IsHTML(true); $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "tls://smtp.gmail.com"; // Amazon SES server, note "tls://" protocol $mail->Port = 465; // set the SMTP port $mail->Username = "******"; // SMTP username $mail->Password = "******"; // SMTP password $mail->SetFrom($from, 'Find Your Perfect Roommate'); $mail->AddReplyTo($from, 'Reply to Find Your Perfect Roommate'); $mail->Subject = $subject; $mail->MsgHTML($body); $address = $to; $mail->AddAddress($address, $to); $mail->Send(); }
function mailer($from, $from_email, $to, $to_email, $subject, $content, $files) { $content = nl2br($content); $mail = new PHPMailer(true); $mail->IsSendmail(); try { $mail->CharSet = "utf-8"; $mail->Encoding = "base64"; $mail->AddAddress($to_email, $to); $mail->SetFrom($from_email, $from); $mail->AddReplyTo($from_email, $from); $mail->Subject = $subject; $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; $mail->MsgHTML($content); if ($files[1] != "") { $mail->AddAttachment("./temp/" . $files[1]); } if ($files[2] != "") { $mail->AddAttachment("./temp/" . $files[2]); } if ($files[3] != "") { $mail->AddAttachment("./temp/" . $files[3]); } $mail->Send(); return true; } catch (phpmailerException $e) { echo $e->errorMessage(); return false; } catch (Exception $e) { echo $e->getMessage(); return false; } }