/** * Send email * @param array $to * @param array $from * @param string $subject * @param string $text * @param bool $use_template * @return bool */ public function send($to, $from, $subject, $text, $use_template = true) { $this->client->setFrom($from[1], $from[0]); $this->client->addAddress($to[1], $to[0]); $this->client->Subject = $subject; if ($use_template) { $template = ' <!DOCTYPE HTML> <html dir="rtl"> <head> <meta charset="utf-8"> </head> <body style="font-family: tahoma, sans-serif !important;"> <div style="font: 13px tahoma,sans-serif !important;direction: rtl;background-color: #e8e8e8;"> <div style="width: 70%;background-color: #fff;background-color: #fff; border-radius: 3px;margin: auto;position: relative;border-left: 1px solid #d9d9d9;border-right: 1px solid #d9d9d9;"> <div style="top: 0;position: absolute;width: 100%; height: 4px;background: url( \'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAECAYAAAD8kH0gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGhJREFUeNpi/P///xkGKFh27TfDkiu/GQiBKC1WhhgdVoLqXkzsZHje30ZQnUR+OYNkYRVWORZkxy0DOo6JgGERpDhuYgcDAxN+EyVyS3E6DgSYkB3HQG3HEQo5Ao4DO3AwOw4EAAIMAMZJM9nl1EbWAAAAAElFTkSuQmCC\' ) repeat;"></div> <div style="padding: 22px 15px;"> {TEXT} </div> <div style="bottom: 0;position: absolute;width: 100%; height: 4px;background: url( \'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAECAYAAAD8kH0gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGhJREFUeNpi/P///xkGKFh27TfDkiu/GQiBKC1WhhgdVoLqXkzsZHje30ZQnUR+OYNkYRVWORZkxy0DOo6JgGERpDhuYgcDAxN+EyVyS3E6DgSYkB3HQG3HEQo5Ao4DO3AwOw4EAAIMAMZJM9nl1EbWAAAAAElFTkSuQmCC\' ) repeat;"></div> </div> </div> </body> </html> '; $msg = str_replace('{TEXT}', $text, $template); } else { $msg = $text; } $this->client->msgHTML($msg); return $this->client->send(); }
function send() { $conf = $this->smtp; $mail = new PHPMailer(); $mail->IsSMTP(false); //$mail->Host = $conf['host']; //$mail->SMTPAuth = true; $mail->IsHTML(true); //$mail->SMTPDebug = 2; //$mail->Port = $conf['port']; //$mail->Username = $conf['user']; //$mail->Password = $conf['pass']; //$mail->SMTPSecure = 'tls'; $mail->setFrom($this->from, 'Onboarding Mail'); $mail->addReplyTo($this->from, 'Onboarding Mail'); $mail->addAddress($this->to); foreach ($this->attachment as $k => $att) { $num = $k + 1; $fname = "Events{$num}_" . date('h:i:s') . ".ics"; $mail->AddStringAttachment($att, $fname, 'base64', 'text/ics'); } $mail->Subject = $this->subject; $mail->Body = $this->bodyText; if (!$mail->send()) { echo '<pre>'; echo 'Message could not be sent.<br>'; echo 'Mailer Error: ' . $mail->ErrorInfo; exit; } }
/** * Function to send an email to a specific email address * with provided receiver name as well as all the content * of the email * Use the PHPMailer library * return error message on failure * * $addr is the receiver email address * $name is the receiver name * $subject is the Subject of the email * $body is the main content of the email in HTML format * $altbody is the alternate content of the email, use in * case receiver's browser doesn't support HTML email */ function sendMail($addr, $name, $subject, $body, $altbody) { $mail = new PHPMailer(); //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->CharSet = 'UTF-8'; // Encode using Unicode $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP email username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom('*****@*****.**', 'Hoi con trai VNNTU'); $mail->addAddress($addr, $name); $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; // Set email subject $mail->Body = $body; // Set email body $mail->AltBody = $altbody; // Set email alternate body // Output error message in case of failure if (!$mail->send()) { return $mail->ErrorInfo; } }
/** * Populate the email message */ private function populateMessage() { $attributes = $this->attributes; $this->mailer->CharSet = 'UTF-8'; $this->mailer->Subject = $attributes['subject']; $from_parts = Email::explodeEmailString($attributes['from']); $this->mailer->setFrom($from_parts['email'], $from_parts['name']); $to = Helper::ensureArray($this->attributes['to']); foreach ($to as $to_addr) { $to_parts = Email::explodeEmailString($to_addr); $this->mailer->addAddress($to_parts['email'], $to_parts['name']); } if (isset($attributes['cc'])) { $cc = Helper::ensureArray($attributes['cc']); foreach ($cc as $cc_addr) { $cc_parts = Email::explodeEmailString($cc_addr); $this->mailer->addCC($cc_parts['email'], $cc_parts['name']); } } if (isset($attributes['bcc'])) { $bcc = Helper::ensureArray($attributes['bcc']); foreach ($bcc as $bcc_addr) { $bcc_parts = Email::explodeEmailString($bcc_addr); $this->mailer->addBCC($bcc_parts['email'], $bcc_parts['name']); } } if (isset($attributes['html'])) { $this->mailer->msgHTML($attributes['html']); if (isset($attributes['text'])) { $this->mailer->AltBody = $attributes['text']; } } elseif (isset($attributes['text'])) { $this->mailer->msgHTML($attributes['text']); } }
/** * ### Sets the basic PHPMailer settings and content * * Mail constructor. * @param array $to * @param string $subject * @param string $content */ public function __construct($to = [], $subject = '', $content = '') { $this->mailer = new \PHPMailer(); $this->protocol(Config::get('mail', 'protocol')); $this->mailer->Host = Config::get('mail', 'host'); $this->mailer->Port = Config::get('mail', 'port'); $this->mailer->Username = Config::get('mail', 'username'); $this->mailer->Password = Config::get('mail', 'password'); $this->mailer->SMTPSecure = Config::get('mail', 'encryption'); $this->mailer->setFrom(Config::get('mail', 'from')[0], Config::get('mail', 'from')[1]); $this->mailer->addAddress($to[0], $to[1]); $this->mailer->isHTML(true); $this->mailer->Subject = $subject; $this->mailer->Body = $content; }
public static function send($to_email, $reply_email, $reply_name, $from_email, $from_name, $subject, $body, $attachments = array()) { if (Configuration::model()->emailer->relay == 'SMTP') { $email = new \PHPMailer(); //$email->SMTPDebug = 4; $email->isSMTP(); $email->Host = Configuration::model()->emailer->host; $email->SMTPAuth = Configuration::model()->emailer->auth; $email->Username = Configuration::model()->emailer->username; $email->Password = Configuration::model()->emailer->password; $email->SMTPSecure = Configuration::model()->emailer->security; $email->Port = Configuration::model()->emailer->port; } $email->addAddress($to_email); $email->addReplyTo($reply_email, $reply_name); $email->setFrom($from_email, $from_name); $email->Subject = $subject; $email->Body = $body; $email->msgHTML($body); $email->AltBody = strip_tags(str_replace('<br>', "\n\r", $body)); if (is_array($attachments)) { foreach ($attachments as $value) { $email->addAttachment($value); } } $email->send(); }
public static function GetMailer($address = '') { $emailConfig = Config::Get('email'); $currentConfig = $emailConfig[$address] ? $emailConfig[$address] : $emailConfig['default']; $address = $currentConfig['address']; if (!$currentConfig) { return false; } if (!self::$phpMailers[$address]) { $mailer = new PHPMailer(); $mailer->isSMTP(); $mailer->Host = $currentConfig['stmp_host']; $mailer->Username = $currentConfig['user']; $mailer->Password = $currentConfig['pwd']; $mailer->SMTPAuth = true; $mailer->Port = $currentConfig['port']; $mailer->CharSet = "utf-8"; $mailer->setFrom($currentConfig['address']); $mailer->isHTML(); } else { $mailer = self::$phpMailers[$address]; } $mailer->clearAllRecipients(); self::$phpMailers[$address] = $mailer; return $mailer; }
public function dispararEmail($template_email_id = 0, $user = array(), $extra_data = array()) { $mail = new \PHPMailer(); $template_emails = TableRegistry::get("TemplateEmails"); $template_email = $template_emails->get($template_email_id); $html = $template_email->content; $html = str_replace('{{user}}', $user->full_name, $html); $html = str_replace('{{password}}', @$extra_data['new_password'], $html); $html = str_replace('{{current_password}}', @$extra_data['current_password'], $html); foreach ($extra_data as $key => $val) { $html = str_replace('{{' . $key . '}}', $val, $html); } $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.smtp2go.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password // $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 2525; // TCP port to connect to $mail->setFrom('*****@*****.**', 'Pedro Sampaio'); $mail->addAddress($user->username); // Name is optional $mail->isHTML(true); // Set email format to HTML $mail->Subject = '[PEP] ' . $template_email->title; $mail->Body = $html; $mail->AltBody = $html; return $mail->send(); }
public function onLoad($param) { parent::onLoad($param); $checkNewsletter = nNewsletterRecord::finder()->findByStatus(1); if ($checkNewsletter) { $layout = nLayoutRecord::finder()->findBy_nNewsletterID($checkNewsletter->ID); $mail = new PHPMailer(); $mail->isSendmail(); $mail->setFrom('*****@*****.**', 'First Last'); $mail->addReplyTo('*****@*****.**'); $lista = nSenderRecord::finder()->findAll('nLayoutID = ? AND Status = 0 LIMIT 25', $layout->ID); foreach ($lista as $person) { $mail->addAddress($person->Email); $mail->Subject = $checkNewsletter->Name; $mail->msgHTML($layout->HtmlText); if ($mail->send()) { $person->Status = 1; $person->save(); } else { $person->Status = 5; $person->save(); echo "Mailer Error: " . $mail->ErrorInfo; } } if (empty($lista)) { $checkNewsletter->Status = 0; $checkNewsletter->save(); } } die; }
public static function init() { $mail = new PHPMailer(); //Tell PHPMailer to use SMTP $mail->isSMTP(); //Enable SMTP debugging // 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail->SMTPDebug = 0; //Ask for HTML-friendly debug output $mail->Debugoutput = 'html'; //Set the hostname of the mail server $mail->Host = FRELAY_SMTP; $mail->SMTPSecure = "tls"; //Set the SMTP port number - likely to be 25, 465 or 587 $mail->Port = FSMTP_PORT; //Whether to use SMTP authentication $mail->SMTPAuth = true; $mail->Username = FSMTP_USER; $mail->Password = FSMTP_PASS; //Set who the message is to be sent from $mail->setFrom(FSMTP_FROM, FSMTP_FROM_NAME); self::$obMailer = $mail; }
function processMail($from, $to, $subject, $messageBody, $messageBodyTxt) { $mail = new PHPMailer(); $mail->SMTPDebug = false; // Enable verbose debug output $mail->CharSet = "UTF-8"; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.speedpartner.de'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 25; // TCP port to connect to $mail->setFrom($from, 'Mailer'); $mail->addAddress($to); // Add a recipient $mail->addReplyTo($from); $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; $mail->Body = $messageBody; if (strlen(trim($messageBodyTxt)) > 0) { $mail->AltBody = $messageBodyTxt; } if (!$mail->send()) { $sendingResults = "{\"result\" : \"error\",\"message\" : \"Message could not be sent\", \"PHPMailerMsg\" : \"" . $mail->ErrorInfo . "\"}"; } }
function sendMail($mail, $message) { $mail = new PHPMailer(); //$mail->SMTPDebug = 2; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom('*****@*****.**', 'Mailer'); $mail->addAddress('$mail'); // Add a recipient $mail->isHTML(false); // Set email format to HTML $mail->Subject = 'Bienvenue sur Molpe !'; $mail->Body = '$message'; /*if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { //echo 'Message has been sent'; }*/ }
function sendEmail($force, $clients, $subject, $body, $resources = array()) { $mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = SMTP_HOST; $mail->SMTPAuth = true; $mail->Username = EMAIL; $mail->Password = PASSWORD; $mail->SMTPSecure = SMTP_SECURE; $mail->Port = SMTP_PORT; $mail->setFrom(EMAIL, 'The cat long'); $mail->isHTML(true); $mail->Subject = $subject; foreach ($clients as $client) { if (EMAIL != $client['email'] && !empty($client['news']) || !!$force) { $mail->addAddress($client['email']); } } $mail->Body = $body; foreach ($resources as $i) { if (!isset($i['absolute'])) { $mail->addAttachment(IMGS . $i['path']); } else { $mail->addAttachment($i['path']); } } $mail->AltBody = $body; if ($mail->send()) { flash('msg', 'Su email se ha enviado correctamente', 'Notificación'); return header('location: /'); } }
public function gogo($email) { $mail = new PHPMailer(); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.your-server.de'; // Specify main and backup server $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted $mail->Port = 25; //Set the SMTP port number - 587 for authenticated TLS $mail->setFrom('*****@*****.**', 'Matchday'); //Set who the message is to be sent from $mail->addAddress($email); // Add a recipient $mail->isHTML(true); // Set email format to HTML $mail->CharSet = 'UTF-8'; $text = "Информация по инциденту 22.01.2016"; $text = iconv(mb_detect_encoding($text, mb_detect_order(), true), "UTF-8", $text); $mail->Subject = $text; $mail->Body = "Уважаемые пользователи ресурса matchday.biz! <br/><br/>\n\t\t\n\t\tБез всякого предупреждения нас отключили от хостинга. Хостер (немецкая компания hetzner.de) обнаружил перегрузку сервера, связанную с многочисленными запросами, идущими на наш сайт со стороннего адреса и отключил нас, отказавшись далее разбираться до понедельника.\n\t\tНаши специалисты диагностировали проблему и выяснили, что запросы идут с пула IP адресов ТОГО ЖЕ хостера – то есть, от него самого, что свидетельствует о том, что у хостера просто некорректно налажена работа самого хостинга.\n\t\tТехподдержка с нами отказалась работать после 18-00 пятницы немецкого времени, и сайт matchday.biz будет теперь гарантировано лежать до середины дня понедельника, 25 января.\n\t\t(желающие прочитать про очень похожий случай с этим же хостером могут сделать это тут).<br/><br/>\n\t\t\n\t\tНезависимо от того, чем закончится эта история, мы будем менять хостера, но локальная задача – включить сайт, чем мы и будем заниматься, увы, теперь только в понедельник.\n\t\tМы очень извиняемся за неудобства, причиненные этой историей, которая полностью находится вне нашего контроля.<br/><br/>\n\t\t\n\t\tПодкаст по итогам 23го тура будет записан авторами в воскресение и будет опубликован, как только сайт станет доступным.\n\t\tНи бетмен-лайв, ни фэнтэзи-лайв в23м туре провести не представляется возможным.<br/>\n\t\tВ бетмене все ставки будут засчитаны.<br/><br/>\n\t\t\n\t\tО доступности сайта мы немедленно вас проинформируем, в том числе и на сайте arsenal-blog.com.<br/><br/>\n\t\t\n\t\t\n\t\tАдминистрация matchday.biz"; if (!$mail->send()) { return false; } return true; }
public function configureMailer() { $mail = new \PHPMailer(); // $mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = getenv('EMAIL_SMTP'); // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = getenv('EMAIL_FROM'); // SMTP username $mail->Password = getenv('EMAIL_FROM_PASSWORD'); // SMTP password $mail->SMTPSecure = getenv('EMAIL_SMTP_SECURITY'); // Enable TLS encryption, `ssl` also accepted $mail->Port = getenv('EMAIL_SMTP_PORT'); // TCP port to connect to //From myself to myself (alter reply address) $mail->setFrom(getenv('EMAIL_FROM'), getenv('EMAIL_FROM_NAME')); $mail->addAddress(getenv('EMAIL_TO'), getenv('EMAIL_TO_NAME')); $mail->isHTML(true); // Set email format to HTML return $mail; }
public function SendEmail($account, $type) { $email = new \PHPMailer(); $email->isSMTP(); // $email->Timeout = 120; //$email->SMTPDebug = 2; //$email->Debugoutput = 'html'; $email->Host = "smtp.gmail.com"; $email->Port = 587; $email->SMTPSecure = "tls"; $email->SMTPAuth = true; $email->Username = "******"; $email->Password = "******"; $email->setFrom("*****@*****.**", "Retos"); $email->addReplyTo("*****@*****.**", "Retos"); $email->addAddress("{$account}"); $email->isHTML(true); $email->Subject = "Retos | Chontal Developers"; $file = dirname(__DIR__) . "/views/email/index.html"; $email->msgHTML(file_get_contents($file)); if ($type == 1) { $email->AltBody = "Gracias por contactarnos en breve nos comunicaremos con usted. Les agradece El equipo Retos."; } else { if ($type == 2) { $email->AltBody = "Gracias por suscribirse a nuestro sito http://www.retos.co"; } } if (!$email->send()) { //echo 'Message could not be sent.'; //echo 'Mailer Error: ' . $email->ErrorInfo; } else { return true; } }
public function EnviarCorreo(CorreosDTO $dto) { $mail = new PHPMailer(); $mail->isSMTP(); //Correo del remitente $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->Username = $dto->getRemitente(); $mail->Password = $dto->getContrasena(); $mail->SMTPSecure = 'tls'; $mail->Port = 587; $mail->CharSet = 'UTF-8'; $mail->setFrom($dto->getRemitente(), $dto->getNombreRemitente()); //Correo del destinatario $mail->addAddress($dto->getDestinatario()); $mail->addReplyTo($dto->getRemitente(), $dto->getNombreRemitente()); $mail->addAttachment($dto->getArchivos()); //Adjuntar Archivos $mail->isHTML(true); $mail->Subject = $dto->getAsunto(); //Cuerpo del correo $mail->Body = $dto->getContenido(); if (!$mail->send()) { $mensaje2 = 'No se pudo enviar el correo ' . 'Error: ' . $mail->ErrorInfo; } else { $mensaje2 = 'True'; } return $mensaje2; }
public function userActivation($name, $adresse, $link) { global $CONFIG; $mail = new PHPMailer(); //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = $CONFIG["MailHost"]; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = $CONFIG["MailUser"]; // SMTP username $mail->Password = $CONFIG["MailPasswort"]; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom($CONFIG["MailAdresse"], $CONFIG["MailName"]); $mail->addAddress($adresse, $name); // Add a recipient $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'TerminGrul Benutzer Bestaetigung'; $mail->Body = 'Hier der Link zum Verifizieren deiner Mailadresse:<br><a href="' . $link . '">TerminGrul Verifizierung</a>'; $mail->AltBody = 'Hier der Link zum Verifizieren deiner Mailadresse: ' . $link; $mail->send(); }
protected function setup_phpmailer() { $mail = new \PHPMailer(); $mail->isSMTP(); // Configure SMTP Server $mail->Host = $this->smtp_config->host; $mail->SMTPAuth = $this->smtp_config->auth; $mail->Port = $this->smtp_config->port; $mail->setFrom($this->smtp_config->send_email, 'Server Monitor'); // Optional SMTP settings if (isset($this->smtp_config->secure)) { $email->SMTPSecure = $this->smtp_config->secure; } if (isset($this->smtp_config->auth)) { $mail->Username = $this->smtp_config->username; $mail->Password = $this->smtp_config->password; } // Add subject $mail->Subject = $this->email_subject; // Add text $mail->Body = $this->email_text; // Add recipients $mail = $this->add_email_addresses($mail, $this->email_addresses); return $mail; }
public function sendMessage($from, $to, $subject, $body) { $config = $this->get('config')->data['services']['mailer']; $mail = new PHPMailer(); // Configure SMTP ob_start(); if ($config['smtp']) { $mail->SMTPDebug = 3; $mail->isSMTP(); $mail->Timeout = 15; $mail->SMTPAuth = true; $mail->SMTPSecure = $config['smtpSecure']; $mail->Host = $config['smtpHost']; $mail->Port = $config['smtpPort']; $mail->Username = $config['smtpUser']; $mail->Password = $config['smtpPass']; } // Prepare the message $mail->setFrom($config['smtpUser']); $mail->addAddress($to); $mail->addReplyTo($from); $mail->isHTML(true); $mail->CharSet = 'UTF-8'; $mail->Subject = $subject; $mail->Body = $body; $mail->AltBody = $body; // Send $success = $mail->send(); $debugInfo = ob_get_contents(); ob_end_clean(); if (!$success) { $this->get('logger')->error($mail->ErrorInfo . "\nDebug information:\n\n" . $debugInfo); } return $success; }
function MailGin($correo, $nom, $msj) { //Template Admin $templateAdmin = file_get_contents('MailAdminForm.html'); $templateAdmin = str_replace('%nombre%', $nom, $templateAdmin); $templateAdmin = str_replace('%email%', $correo, $templateAdmin); $templateAdmin = str_replace('%mensaje%', $msj, $templateAdmin); $templateAdmin = str_replace('\\r\\n', '<br>', $templateAdmin); //Envia Mail $mail = new PHPMailer(); $mail->Host = gethostbyname('smtp.gmail.com'); //$mail->SMTPDebug = 3; $mail->isSMTP(); $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->SMTPSecure = "tls"; $mail->Username = '******'; $mail->Password = '******'; $mail->Port = 587; $mail->setFrom('*****@*****.**', 'Gin Gin'); $mail->addAddress('jcisneros@iegroup.mx ', 'Cisneros'); $mail->addAddress('*****@*****.**', 'Iegroup'); //$mail->addAddress('*****@*****.**','Developer'); $mail->isHTML(true); $mail->CharSet = 'UTF-8'; $mail->Subject = 'Has recibido un nuevo mensaje desde gin-gin.mx'; $mail->Body = $templateAdmin; $mail->send(); /* if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent' ; } */ //Template Usuario $templateUser = file_get_contents('MailUserForm.html'); $templateUser = str_replace('%nombre%', $nom, $templateUser); $templateUser = str_replace('\\r\\n', '<br>', $templateUser); //Envia Mail $mail = new PHPMailer(); $mail->Host = gethostbyname('smtp.gmail.com'); //$mail->SMTPDebug = 3; $mail->isSMTP(); $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->SMTPSecure = "tls"; $mail->Username = '******'; $mail->Password = '******'; $mail->Port = 587; $mail->setFrom('*****@*****.**', 'Gin Gin'); //$mail->addAddress('jcisneros@iegroup.mx ','Cisneros'); //$mail->addAddress('*****@*****.**','Iegroup'); $mail->addAddress($correo); $mail->isHTML(true); $mail->CharSet = 'UTF-8'; $mail->Subject = 'Gracias por contactarnos a gin-gin.mx'; $mail->Body = $templateUser; $mail->send(); }
function autoMail($to, $subject, $messsageHTML, $messageText) { require_once 'PHPMailer-master/PHPMailerAutoload.php'; $mail = new PHPMailer(); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.googlemail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; $mail->Port = 587; // TCP port to connect to $mail->setFrom('*****@*****.**', 'Yelp Website admin : password lost'); $mail->addAddress($to); //$mail->addBCC('*****@*****.**'); $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; $mail->Body = $messsageHTML; $mail->AltBody = $messageText; return $mail->send(); }
/** * Send an email * * @param string $name Name * @param string $email Email address * @param string $subject Subject * @param string $body Body * @return boolean true if the email was sent successfully, false otherwise */ public static function send($name, $email, $subject, $body) { require dirname(dirname(__FILE__)) . '/vendors/PHPMailer/PHPMailerAutoload.php'; $mail = new PHPMailer(); //Set PHPMailer to use SMTP. $mail->isSendMail(); //Set SMTP host name $mail->Host = Config::SMTP_HOST; //Set this to true if SMTP host requires authentication to send email $mail->SMTPAuth = true; //Provide username and password $mail->Username = Config::SMTP_USER; $mail->Password = Config::SMTP_PASS; //If SMTP requires TLS encryption then set it $mail->SMTPSecure = Config::SMTP_CERTIFICATE; //Set TCP port to connect to $mail->Port = Config::SMTP_PORT; $mail->setFrom($email, $name); $mail->addAddress(Config::SMTP_USER, Config::SMTP_NAME); $mail->isHTML(true); $mail->Subject = $subject; $mail->Body = $body; if (!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } }
/** * Test addressing. */ public function testAddressing() { $this->assertFalse($this->Mail->addAddress(''), 'Empty address accepted'); $this->assertFalse($this->Mail->addAddress('', 'Nobody'), 'Empty address with name accepted'); $this->assertFalse($this->Mail->addAddress('*****@*****.**'), 'Invalid address accepted'); $this->assertTrue($this->Mail->addAddress('*****@*****.**'), 'Addressing failed'); $this->assertFalse($this->Mail->addAddress('*****@*****.**'), 'Duplicate addressing failed'); $this->assertTrue($this->Mail->addCC('*****@*****.**'), 'CC addressing failed'); $this->assertFalse($this->Mail->addCC('*****@*****.**'), 'CC duplicate addressing failed'); $this->assertFalse($this->Mail->addCC('*****@*****.**'), 'CC duplicate addressing failed (2)'); $this->assertTrue($this->Mail->addBCC('*****@*****.**'), 'BCC addressing failed'); $this->assertFalse($this->Mail->addBCC('*****@*****.**'), 'BCC duplicate addressing failed'); $this->assertFalse($this->Mail->addBCC('*****@*****.**'), 'BCC duplicate addressing failed (2)'); $this->assertTrue($this->Mail->addReplyTo('*****@*****.**'), 'Replyto Addressing failed'); $this->assertFalse($this->Mail->addReplyTo('*****@*****.**'), 'Invalid Replyto address accepted'); $this->assertTrue($this->Mail->setFrom('*****@*****.**', 'some name'), 'setFrom failed'); $this->assertFalse($this->Mail->setFrom('a@example.com.', 'some name'), 'setFrom accepted invalid address'); $this->Mail->Sender = ''; $this->Mail->setFrom('*****@*****.**', 'some name', true); $this->assertEquals($this->Mail->Sender, '*****@*****.**', 'setFrom failed to set sender'); $this->Mail->Sender = ''; $this->Mail->setFrom('*****@*****.**', 'some name', false); $this->assertEquals($this->Mail->Sender, '', 'setFrom should not have set sender'); $this->Mail->clearCCs(); $this->Mail->clearBCCs(); $this->Mail->clearReplyTos(); }
function sendWelcomeEmail($email) { $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Debugoutput = 'html'; $mail->Host = "sub5.mail.dreamhost.com"; // specify main and backup server $mail->Port = 587; $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "******"; // SMTP username $mail->Password = "******"; // SMTP password $mail->setFrom("*****@*****.**", "Roscr Admin"); $mail->AddAddress($email); $mail->IsHTML(true); // set email format to HTML $mail->msgHTML(file_get_contents('welcome.html'), dirname(__FILE__)); $mail->AltBody = $emailText; $mail->Subject = "Subscription to ROSCr"; $mail->WordWrap = 50; // set word wrap to 50 characters if (!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Message has been sent"; }
function sendmail($Email, $content) { date_default_timezone_set('Etc/UTC'); require "PHPMailer/PHPMailerAutoload.php"; $mail = new PHPMailer(); $mail->isSMTP(); $mail->SMTPDebug = 2; $mail->Debugoutput = 'html'; $mail->Host = 'smtp.gmail.com'; $mail->Port = 587; $mail->SMTPSecure = 'tls'; $mail->SMTPAuth = true; $mail->Username = "******"; $mail->Password = "******"; $mail->setFrom('*****@*****.**', 'book printer'); $mail->addReplyTo('*****@*****.**', 'book printer'); $mail->addAddress($Email, ' '); if (!strcmp($content, 'GETKEY')) { $mail->Subject = 'bookmyprinter verification mail'; $key = rand(1, 999999); $mail->Body = '你的認證碼是: ' . $key; } else { $mail->Subject = 'bookmyprinter user report'; $mail->Body = $content; } $mail->SMTPDebug = 0; $mail->send(); if (!strcmp($content, 'GETKEY')) { return $key; } else { return 1; } }
public function restaurarcuenta() { View::template('sbadmin'); if (Input::hasPost('correo')) { $Usuario = new Usuario(); $direccion = $_POST['correo']['email']; if ("SELECT count(*) FROM usuario WHERE email = '{$direccion}'" == 1) { $mail = new PHPMailer(); $mail->isSMTP(); //$mail>SMTPDebug = 2; $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; $mail->Port = 465; $mail->Username = "******"; $mail->Password = "******"; $mail->setFrom('*****@*****.**', 'Gestión Documental'); //$mail>AddReplyTo("*****@*****.**", "Steven Ruiz"); $mail->Subject = "asunto"; $mail->msgHTML("mensaje"); //$address = "*****@*****.**"; $mail->addAddress($_POST['correo']['email'], "..."); if (!$mail->send()) { echo "Error al enviar: " . $mail->ErrorInfo; } Input::delete(); } else { print_r("No hay cuenta asociada al correo digitado"); } } }
function sendMail($emailto, $subject, $body, $altbody) { $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.syesoftware.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->Port = 26; // TCP port to connect to $mail->setFrom('*****@*****.**', 'La Parrilla Express'); $mail->addAddress($emailto); // Name is optional $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; $mail->Body = $body; $mail->AltBody = $altbody; if (!$mail->send()) { return 'EL/Los mensaje(s) no ha(n) sido enviado(s). Error: ' . $mail->ErrorInfo; } else { return 'El/Los mensaje(s) ha(n) sido enviado(s)'; } }
function send_notificationEmail_memberRegistration($userEmail, $titleAndName, $student) { //Email an den Verein $toEmail = '*****@*****.**'; $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; //Empfänger $mail->addAddress($toEmail); //Absender $mail->setFrom('*****@*****.**', 'aluMPI'); $mail->addReplyTo('*****@*****.**', 'aluMPI'); //Betreff der Email $mail->Subject = 'Neue Registrierung bei AluMPI'; //Inhalt der Email $message = "\nHallo,\n\n" . $titleAndName . " hat sich soeben auf der Webseite zum Verein angemeldet.\nDie E-Mail-Adresse lautet " . $userEmail . "\n\n"; if ($student == "j") { $message = $message . "\nDas neue Mitglied hat angegeben Student zu sein. Sollte in der nächsten Woche keine Studentenbescheinigung vorliegen, so erinnern Sie das neue Mitglied daran!\n"; } $message = $message . "\t \nPrüfen Sie ob das Mitglied in der Datenbank bestätigt wurde!\n"; $mail->Body = $message; if (!$mail->send()) { return false; } else { return true; } }
function send_mail($from, $email, $tpl, $data = array()) { try { //Create a new PHPMailer instance $mail = new PHPMailer(); // Set PHPMailer to use the sendmail transport //$mail->isSendmail(); //Set who the message is to be sent from $mail->setFrom($from, $from); //Set an alternative reply-to address $mail->addReplyTo($from, $from); //Set who the message is to be sent to $mail->addAddress($email, ''); //$mail->addAddress( '*****@*****.**', ''); //Set the subject line $mail->Subject = isset($data['emailsubject']) ? $data['emailsubject'] : 'email from ' . $from; //Read an HTML message body from an external file, convert referenced images to embedded, //convert HTML into a basic plain-text alternative body $mail->msgHTML(template_file($tpl, $data)); //Replace the plain text body with one created manually $mail->AltBody = ''; $mail->CharSet = 'utf-8'; if ($mail->send()) { } } catch (Exception $e) { print_r($e); } }