PHP Class PHPMailer, phpmailer Code Examples

This page contains top rated real world PHP examples of class PHPMailer from package phpmailer extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: Notice.php Project: qious/Hnust
0
 public static function mail($address, $title, $content)
 {
     if (empty($address)) {
         return false;
     }
     $mail = new \PHPMailer();
     //服务器配置
     $mail->isSMTP();
     $mail->SMTPAuth = true;
     $mail->Host = 'smtp.qq.com';
     $mail->SMTPSecure = 'ssl';
     $mail->Port = 465;
     $mail->CharSet = 'UTF-8';
     //用户名设置
     $mailInfo = Config::getConfig('mail_info');
     $mailInfo = json_decode($mailInfo, true);
     $mail->FromName = $mailInfo['fromName'];
     $mail->Username = $mailInfo['userName'];
     $mail->Password = $mailInfo['password'];
     $mail->From = $mailInfo['from'];
     $mail->addAddress($address);
     //内容设置
     $mail->isHTML(true);
     $mail->Subject = $title;
     $mail->Body = $content;
     //返回结果
     if ($mail->send()) {
         return true;
     } else {
         return false;
     }
 }
Example #2
Show file File: esqueci.php Project: Teawith/maso4ada
0
function smtpmailer($para, $de, $de_nome, $assunto, $corpo)
{
    global $error;
    $mail = new PHPMailer();
    $mail->IsSMTP();
    // Ativar SMTP
    $mail->SMTPDebug = 0;
    // Debugar: 1 = erros e mensagens, 2 = mensagens apenas
    $mail->SMTPAuth = true;
    // Autenticação ativada
    $mail->SMTPSecure = 'tls';
    // SSL REQUERIDO pelo GMail
    $mail->Host = 'smtp.live.com';
    // SMTP utilizado
    $mail->Port = 587;
    // A porta 587 deverá estar aberta em seu servidor
    $mail->Username = GUSER;
    $mail->Password = GPWD;
    $mail->SetFrom($de, $de_nome);
    $mail->Subject = $assunto;
    $mail->Body = $corpo;
    $mail->AddAddress($para);
    if (!$mail->Send()) {
        $error = 'Mail error: ' . $mail->ErrorInfo;
        return false;
    } else {
        $error = 'Mensagem enviada!';
        return true;
    }
}
Example #3
Show file File: Finah.php Project: GertClaeskens/AppDev07
0
 static function send_mail()
 {
     $mailer = new PHPMailer();
     $mailer->IsSMTP();
     $mailer->Host = 'ssl://smtp.gmail.com:465';
     $mailer->SMTPAuth = TRUE;
     $mailer->Username = 'fake[ @ ] googlemail.com';
     // Change this to your gmail adress
     $mailer->Password = 'fakepassword';
     // Change this to your gmail password
     $mailer->From = 'fake[ @ ] googlemail.com';
     // This HAVE TO be your gmail adress
     $mailer->FromName = 'fake';
     // This is the from name in the email, you can put anything you like here
     $mailer->Body = 'This is the main body of the email';
     $mailer->Subject = 'This is the subject of the email';
     $mailer->AddAddress('fake2[ @ ] gmail.com');
     // This is where you put the email adress of the person you want to mail
     if (!$mailer->Send()) {
         echo "Message was not sent<br/ >";
         echo "Mailer Error: " . $mailer->ErrorInfo;
     } else {
         echo "Message has been sent";
     }
 }
Example #4
Show file File: mail.php Project: espixxl/topguay
0
function sendMail($subject = MAIL_SUBJECT, $body = "", $to = "topguay@topguay.com")
{
    $mail = new PHPMailer();
    $mail->IsSMTP();
    // telling the class to use SMTP
    $mail->Host = MAIL_HOST;
    // SMTP server
    $mail->From = MAIL_FROM;
    $mail->FromName = MAIL_FROMNAME;
    $mail->Subject = $subject;
    $mail->SMTPAuth = true;
    $mail->Username = MAIL_USERNAME;
    $mail->Password = MAIL_PASSWORD;
    $mail->AltBody = "Para ver el mensaje, use un visor de e-mail compatible con HTML.";
    // optional, comment out and test
    $mail->MsgHTML($body);
    $mail->AddAddress($to);
    if (!$mail->Send()) {
        // echo "Mailer Error: " . $mail->ErrorInfo;
        return $mail->ErrorInfo;
    } else {
        // echo "Message sent!";7
        return true;
    }
}
Example #5
Show file File: Core.php Project: Crecket/advanced-login-script
0
 /**
  * Send a email with the given message and title. Targets are in array form >   array("name" => "Target's name", "email" => "Target's email address")
  * @param $message
  * @param $title
  * @param array $target
  * @return bool
  * @throws Exception
  * @throws phpmailerException
  */
 public function sendMail($message, $title, $target = array())
 {
     if (!class_exists('PHPMailer')) {
         throw new Exception("Couldn't find PHPMailer class!");
     }
     $mail = new \PHPMailer();
     // create a new object
     $mail->IsSMTP();
     // enable SMTP
     if (ADVANCEDLOGINSCRIPT_DEBUG) {
         $mail->SMTPDebug = 1;
         // debugging: 1 = errors and messages, 2 = messages only
         $mail->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true));
     } else {
         $mail->SMTPDebug = 0;
     }
     $mail->SMTPAuth = true;
     $mail->SMTPSecure = 'tls';
     $mail->Host = ADVANCEDLOGINSCRIPT_EMAIL_HOST;
     $mail->Port = 587;
     $mail->IsHTML(true);
     $mail->Username = ADVANCEDLOGINSCRIPT_EMAIL_USERNAME;
     $mail->Password = ADVANCEDLOGINSCRIPT_EMAIL_PASSWORD;
     $mail->SetFrom(ADVANCEDLOGINSCRIPT_EMAIL_USERNAME);
     $mail->Subject = $title;
     $mail->Body = $message;
     $mail->Timeout = 10;
     // set the timeout (seconds)
     foreach ($target as $person) {
         $mail->addAddress($person['email'], $person['name']);
     }
     return $mail->Send();
 }
Example #6
Show file File: main_functions.php Project: jaranvil/RePost
0
function PHPMailer($xmlDoc, $name, $email, $subject, $message)
{
    require "class.phpmailer.php";
    $parentNode = $xmlDoc->createElement('status');
    $mail = new PHPMailer();
    $mail->IsSMTP();
    // telling the class to use SMTP
    $mail->SMTPAuth = true;
    // SMTP authentication
    $mail->SMTPSecure = "tls";
    $mail->Host = "smtp.gmail.com";
    // SMTP server
    $mail->Port = 587;
    // SMTP Port
    $mail->Username = "jared314@gmail.com";
    // SMTP account username
    $mail->Password = "lnvfcqnotxajucwy";
    // SMTP account password
    $mail->SetFrom('jared314@gmail.com');
    // FROM
    $mail->AddAddress('jared314@gmail.com', 'Jared');
    // recipient email
    $mail->Subject = 'Contact Form Submission';
    // email subject
    $mail->Body = 'FROM: ' . $name . " " . $email . " Subject: " . $subject . " Message: " . $message;
    if (!$mail->Send()) {
        $statusNode = $xmlDoc->createElement('mail_status', 0);
        echo 'Mailer error: ' . $mail->ErrorInfo;
    } else {
        echo 'Message has been sent.';
        $statusNode = $xmlDoc->createElement('mail_status', 1);
    }
    $parentNode->appendChild($statusNode);
    return $parent;
}
Example #7
Show file File: News.php Project: Nilop/mvctest
0
 public function actionSendEmail()
 {
     $mail = new \PHPMailer();
     //будем отравлять письмо через СМТП сервер
     $mail->isSMTP();
     //хост
     $mail->Host = 'smtp.yandex.ru';
     //требует ли СМТП сервер авторизацию/идентификацию
     $mail->SMTPAuth = true;
     // логин от вашей почты
     $mail->Username = 'nik0lai';
     // пароль от почтового ящика
     $mail->Password = '3z2x4c9v0b1nfs';
     //указываем способ шифромания сервера
     $mail->SMTPSecure = 'ssl';
     //указываем порт СМТП сервера
     $mail->Port = '465';
     //указываем кодировку для письма
     $mail->CharSet = 'UTF-8';
     //информация от кого отправлено письмо
     $mail->From = 'nik0lai@yandex.ru';
     $mail->FromName = 'Админ';
     $mail->addAddress($_POST['mail']);
     $mail->isHTML(true);
     $mail->Subject = $_POST['title'];
     $mail->Body = $_POST['text'];
     if ($mail->send()) {
         echo 'Письмо отправлено';
     } else {
         echo 'Письмо не может быть отправлено. ';
         echo 'Ошибка: ' . $mail->ErrorInfo;
     }
 }
Example #8
Show file File: index.php Project: pedradanamente/14.8.2
0
 function smtpmailer($para, $from, $de_nome, $subject, $corpo)
 {
     global $error, $smtpUsuario, $smtpSenha;
     $mail = new PHPMailer();
     $mail->IsSMTP();
     // Ativar SMTP
     $mail->SMTPDebug = 0;
     // Debugar: 1 = erros e mensagens, 2 = mensagens apenas
     $mail->SMTPAuth = true;
     // Autenticação ativada
     $mail->SMTPSecure = 'tls';
     // SSL REQUERIDO pelo GMail
     $mail->Host = 'smtp.gmail.com';
     // SMTP utilizado
     $mail->Port = 587;
     // A porta 587 deverá estar aberta em seu servidor
     $mail->Username = $smtpUsuario;
     $mail->Password = $smtpSenha;
     $mail->SetFrom($from, $de_nome);
     $mail->Subject = $subject;
     $mail->Body = $corpo;
     $mail->AddAddress($para);
     if (!$mail->Send()) {
         $error = '<div class="sent">Mail error: ' . $mail->ErrorInfo . '</div>';
         return false;
     } else {
         $error = '<div class="sent">Enviado com sucesso!</div>';
         return true;
     }
 }
Example #9
Show file File: email.php Project: jafarkhani/rtfund
0
function SendEmail($ToEmail, $subject, $body)
{
    $from = smtp_config::$FromAddress;
    $SMTP_server = smtp_config::$server;
    $SMTP_authenticate = true;
    $SMTP_username = smtp_config::$username;
    $SMTP_password = smtp_config::$password;
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->Host = $SMTP_server;
    $mail->SMTPAuth = $SMTP_authenticate;
    $mail->Username = $SMTP_username;
    $mail->Password = $SMTP_password;
    $mail->From = $from;
    $mail->FromName = SoftwareName;
    $mail->AddAddress($ToEmail, "admin");
    $mail->WordWrap = 50;
    // set word wrap to 50 characters
    $mail->IsHTML(true);
    // set email format to HTML
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->AltBody = "This is the body in plain text for non-HTML mail clients";
    $mail->CharSet = 'utf-8';
    return $mail->Send();
}
Example #10
Show file File: phpmailer_helper.php Project: raminv80/CodeArmy
0
function send_email($recipient, $sender, $subject, $message)
{
    require_once("phpmailer/class.phpmailer.php");
    $mail = new PHPMailer();
    $body = $message;
    $mail->IsSMTP();
    $mail->FromName = "whatever";
    $mail->From = $sender;
    $mail->Subject = $subject;
    $mail->AltBody = strip_tags($message);
    $mail->MsgHTML($body);
    $mail->AddAddress($recipient);

        // added by jerome 5th June 2011
        $mail->SMTPAuth   = true;                  // enable SMTP authentication
        $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
        $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
        $mail->Port       = 465;                   // set the SMTP port

        $mail->Username   = "nnnnnnn";  // GMAIL username
        $mail->Password   = "nnnnnnn";            // GMAIL password

        // end of added by jerome
    if ( ! $mail->Send())
    {
        echo 'Failed to Send';
    }
    else
    {
        echo 'Mail Sent';
    }
}
Example #11
Show file File: PHPMailerServiceProvider.php Project: opensourcerefinery/vicus
0
 public function register(Container $container)
 {
     $container['mail'] = function ($c) {
         //Create a new PHPMailer instance
         $mail = new PHPMailer();
         //Tell PHPMailer to use SMTP
         // if($c['phpmailer']['smtp'])
         $mail->isSMTP();
         //Enable SMTP debugging
         // 0 = off (for production use)
         // 1 = client messages
         // 2 = client and server messages
         $mail->SMTPDebug = $c['phpmailer']['smtpdebug'];
         //Ask for HTML-friendly debug output
         $mail->Debugoutput = 'html';
         //Set the hostname of the mail server
         $mail->Host = $c['phpmailer']['host'];
         //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
         $mail->Port = $c['phpmailer']['port'];
         //Set the encryption system to use - ssl (deprecated) or tls
         $mail->SMTPSecure = $c['phpmailer']['smtpsecure'];
         //Whether to use SMTP authentication
         $mail->SMTPAuth = $c['phpmailer']['smtpauth'];
         //Username to use for SMTP authentication - use full email address for gmail
         $mail->Username = $c['phpmailer']['username'];
         //Password to use for SMTP authentication
         $mail->Password = $c['phpmailer']['password'];
         //Set who the message is to be sent from
         // $mail->setFrom($c['phpmailer.mail'], $c['phpmailer.firm']);
         return $mail;
     };
 }
Example #12
Show file File: SettingAction.class.php Project: Molly2Molly/fiance
0
 public function sendMail($address, $send_user, $from, $title, $message)
 {
     vendor('mail.mail');
     $message = eregi_replace("[\\]", '', $message);
     // preg_replace('/\\\\/','', $message);
     $mail = new PHPMailer();
     $mail->IsSMTP();
     // 设置PHPMailer使用SMTP服务器发送Email
     $mail->CharSet = 'UTF-8';
     // 设置邮件的字符编码,若不指定,则为'UTF-8'
     $mail->Port = $this->setting['mail_port'];
     //端口号
     $mail->AddAddress($address);
     // 添加收件人地址,可以多次使用来添加多个收件人
     //$mail->Body=$message;     // 设置邮件正文
     $mail->MsgHTML($message);
     //$mail->From=$this->setting['mail_username'];    // 设置邮件头的From字段。
     $mail->From = $from;
     // 设置邮件头的From字段。
     $mail->FromName = $this->setting['mail_fromname'];
     // 设置发件人名字
     $mail->Subject = $title;
     // 设置邮件标题
     $mail->Host = $this->setting['mail_smtp'];
     // 设置SMTP服务器。
     $mail->SMTPAuth = true;
     // 设置为“需要验证”
     //$mail->Username=$this->setting['mail_username'];     // 设置用户名和密码。
     $mail->Username = $send_user;
     // 设置用户名和密码。
     $mail->Password = $this->setting['mail_password'];
     // 发送邮件。
     return $mail->Send();
 }
Example #13
Show file File: util.php Project: ZhongxiaYan/house_banking
0
function email($users, $subject, $body, $altbody)
{
    global $CONFIG;
    global $PAGES;
    require_once $PAGES['autoload'];
    $mail = new PHPMailer();
    // $mail->SMTPDebug = 3;
    $mail->isSMTP();
    $mail->Host = "smtp.gmail.com";
    $mail->SMTPAuth = true;
    $mail->Username = $CONFIG['mailer']['email'];
    $mail->Password = $CONFIG['mailer']['password'];
    $mail->SMTPSecure = 'tls';
    $mail->Port = 587;
    $mail->setFrom($CONFIG['mailer']['email'], 'Maid');
    foreach ($users as $user) {
        $mail->addAddress($user->email, $user->name);
    }
    $mail->isHTML(true);
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->AltBody = $altbody;
    if (!$mail->send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
        return false;
    }
    return true;
}
Example #14
Show file File: Mailer.class.php Project: rsanders16/NexusPlus
0
 function send($to, $from, $from_name, $subject, $body)
 {
     global $error;
     $mail = new PHPMailer();
     // create a new object
     $mail->IsSMTP();
     // enable SMTP
     $mail->SMTPDebug = 0;
     // debugging: 1 = errors and messages, 2 = messages only
     $mail->SMTPAuth = true;
     // authentication enabled
     $mail->SMTPSecure = 'ssl';
     // secure transfer enabled REQUIRED for Gmail
     $mail->Host = 'smtp.gmail.com';
     $mail->Port = 465;
     $mail->Username = 'admin@rks.ath.cx';
     $mail->Password = '38004635842326!&';
     $mail->SetFrom($from, $from_name);
     $mail->Subject = $subject;
     $mail->Body = $body;
     $mail->AddAddress($to);
     if (!$mail->Send()) {
         $error = 'Mail error: ' . $mail->ErrorInfo;
         //echo $error;
         //die;
         return false;
     } else {
         $error = 'Message sent!';
         //die;
         return true;
     }
 }
Example #15
Show file File: forgotPassword.php Project: ramakrishna1994/newGateWebsite
0
function sendMail($password, $emailid, $firstname)
{
    $mail = new PHPMailer();
    //Enable SMTP debugging.
    //$mail->SMTPDebug = 3;
    //Set PHPMailer to use SMTP.
    //$mail->isSMTP();
    //Set SMTP host name
    $mail->Host = "mail.goodcreed.in";
    //Set this to true if SMTP host requires authentication to send email
    $mail->SMTPAuth = true;
    //Provide username and password
    $mail->Username = "admin@goodcreed.in";
    $mail->Password = "Saradhi@123";
    //If SMTP requires TLS encryption then set it
    //Set TCP port to connect to
    $mail->Port = 25;
    $mail->From = "admin@goodcreed.in";
    $mail->FromName = "Admin";
    $mail->addAddress($emailid);
    $mail->isHTML(true);
    $mail->Subject = "Gate Password Reset";
    $mail->Body = "<html><head></head><body>\n\t\t\t\t<div style='border:1px solid;border-color:purple;margin:10px;padding:10px'><font color='black'>\n\t\t\t\t<b><em>\n\t\t\t\tHi&nbsp;" . $firstname . ",<br><br>\n\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please click on the below link to reset your password.<br><br>\n\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://gate2016.goodcreed.in/resetpassword.php?p=" . $password . "<br><br>\n\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If you are not the recipient of this mail, please ignore it.\n\t\t\t\t<br><br>\n\t\t\t\tThanks and Regards,<br>\n\t\t\t\tSaradhi(Founder of GoodCreed).</b></em></font>\n\t\t\t\t</div>\n\t\t\t\t</body>\n\t\t\t\t</html>";
    if (!$mail->send()) {
        //  echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
        //echo "Message has been sent successfully";
    }
}
Example #16
Show file File: ajaxContactUs.php Project: ClintonFong/icaweb505a-Online-Diary
0
 function sendEmailNotifier($contactUsEntry)
 {
     assert(isset($contactUsEntry) && $contactUsEntry != "");
     $isSuccessful = false;
     $mail = new PHPMailer();
     //$mail->IsSMTP();                                            // telling the class to use SMTP
     $mail->SMTPDebug = 0;
     // enables SMTP debug information (for testing)
     //$mail->SMTPAuth     = TRUE;                                 // enable SMTP authentication
     //$mail->SMTPSecure   = "ssl";                                // sets the prefix to the server
     //$mail->Host         = "smtp.gmail.com";                     // sets GMAIL as the SMTP server
     //$mail->Port         = 465;                                  // set the SMTP port for the GMAIL server
     $mail->IsHTML(TRUE);
     // gmail account to use to send the email
     //$mail->Username     = "fongclinton.mail.gateway@gmail.com";
     //$mail->Password     = "Password001";
     //$mail->SetFrom("fongclinton.mail.gateway@gmail.com");
     $mail->AddAddress(CONTACT_US_EMAIL, "Contact Us");
     //$mail->AddCC("info@clintonfong.com", "Clinton Fong");
     $mail->Subject = "Contact Us Message from Online Diaries Website";
     $msg = "Firstname: {$contactUsEntry->firstname} <br />";
     $msg .= "Lastname: {$contactUsEntry->lastname} <br />";
     $msg .= "Email: {$contactUsEntry->email}<br />";
     $msg .= "Message: {$contactUsEntry->message}<br>";
     $mail->Body = $msg;
     // Mail it
     $isSuccessful = $mail->Send();
     /*                
             if( !$isSuccessful )
             {
                 //$strResult         .= " Mailer error: {$mail->ErrorInfo}";
             }
     */
     return $isSuccessful;
 }
Example #17
Show file File: mailhelper.class.php Project: xi67/MAB-LAB
0
 public static function sendMail($recipients, $subject, $content)
 {
     $cfg = CfgHelper::getInstance();
     $mail = new PHPMailer();
     // recipients
     if (is_array($recipients)) {
         foreach ($recipients as $r) {
             $mail->AddAddress($r);
         }
     } else {
         if (is_string($recipients)) {
         } else {
             Debug::loge('Wrong recipients parameter ! Should be an array or a string...', 'MailHelper');
             return;
         }
     }
     // sender
     $mail->From = $cfg->getMailFromAddr();
     $mail->FromName = $cfg->getMailFromName();
     $mail->IsHTML(true);
     // Set email format to HTML
     $mail->Subject = $subject;
     $mail->Body = $content;
     if (!$mail->Send()) {
         Debug::loge('Message could not be sent. Mailer Error: ' . $mail->ErrorInfo, 'MailHelper');
     }
 }
Example #18
Show file File: ProtokollRenderer.php Project: quantrocket/planlogiq
0
 public function PFMailSend($sender, $param)
 {
     $Aufgabe = ProtokollDetailAufgabeView::finder()->findByidtm_protokoll_detail($param->CallbackParameter);
     $MailEmpfaenger = OrganisationRecord::finder()->findByPk($Aufgabe->idtm_organisation);
     $mail = new PHPMailer();
     $mail->From = "info@planlogiq.com";
     $mail->FromName = "planlogIQ";
     $mail->Host = "smtp.1und1.de";
     $mail->Mailer = "smtp";
     $mail->SMTPAuth = true;
     $mail->IsSendmail();
     //nur bei 1und1
     $mail->Username = "info@planlogiq.com";
     $mail->Password = "";
     $mail->AddAddress(KommunikationRecord::finder()->find('idtm_organisation=? AND kom_ismain=1 AND kom_type = 3', $Aufgabe->idtm_organisation)->kom_information, $MailEmpfaenger->org_name);
     $mail->Subject = $Aufgabe->prtdet_topic;
     $HTMLMessage = "Sehr geehrte(r) Frau/Herr " . $MailEmpfaenger->org_name . ",<br/><br/>";
     $HTMLMessage .= "die folgende Aufgabe wurde Ihnen zugeordnet:<br/>";
     $HTMLMessage .= "<p><table><tr><td bgcolor='#efefef'>TOP Nr.:</td><td>" . $Aufgabe->idtm_protokoll_detail_group . " </td><td bgcolor='#efefef'>Thema: </td><td>" . utf8_decode($Aufgabe->prtdet_topic) . "</td></tr>";
     $HTMLMessage .= "<tr><td bgcolor='#efefef'>Bis:</td><td colspan='3'><b>" . $Aufgabe->auf_tdate . "</b></td></tr></table>";
     $HTMLMessage .= "<p style='background-color:#efefef'><hr/>" . utf8_decode($Aufgabe->prtdet_descr) . "</p>";
     $HTMLMessage .= "<p style='background-color:#efefef'><hr/>" . utf8_decode($Aufgabe->auf_beschreibung) . "<hr/></p>";
     $HTMLMessage .= "Bitte nicht Antworten! Diese Mail wurde automatisch generiert...";
     $mail->MsgHTML($HTMLMessage);
     if (!$mail->Send()) {
         $this->PFMAILER->TEXT = "error sending the message";
     } else {
         $this->PFMAILER->TEXT = "..done..";
     }
 }
Example #19
Show file File: register.php Project: plmerideth/paul-merideth.com
0
function send_mail($msg_content, $s_email, $s_name)
{
    require '/home/paulme9/public_html/includes/PHPMailer/PHPMailerAutoload.php';
    $mail = new PHPMailer();
    $mail->isSMTP();
    $mail->Host = 'secure150.inmotionhosting.com';
    $mail->SMTPAuth = true;
    $mail->Username = 'admin@paul-merideth.com';
    $mail->Password = 'paW2872Cast';
    $mail->SMTPSecure = "ssl";
    $mail->Port = 465;
    $mail->SMTPDebug = 0;
    //0=none, 1=commands, 2=commands+data
    $mail->Debugoutput = 'html';
    $mail->From = 'admin@paul-merideth.com';
    $mail->FromName = $s_name;
    $mail->Sender = $s_email;
    $mail->ReturnPath = 'admin@paul-merideth.com';
    $mail->addAddress($s_email, $s_name);
    $mail->WordWrap = 60;
    $mail->Subject = 'Registration for paul-merideth.com';
    $mail->Body = $msg_content;
    if (!$mail->send()) {
        return FALSE;
    } else {
        return TRUE;
    }
}
Example #20
Show file File: FX.php Project: pitabaki/seminar_o_matic
0
function EmailError($errorText)
{
    require_once "phpmailer/class.phpmailer.php";
    $mail = new PHPMailer();
    if (EMAIL_ERROR_MESSAGES) {
        $mail->IsSMTP('true');
        // set mailer to use SMTP
        $mail->Host = "192.168.50.27";
        // specify main and backup server
        $mail->SMTPAuth = false;
        // turn on SMTP authentication
        $mail->Username = "";
        // SMTP username
        $mail->Password = "";
        // SMTP password
        $mail->From = "snowball@meyersound.com";
        $mail->FromName = "Error on Snowball";
        $mail->WordWrap = 70;
        // set word wrap to 70 characters
        $mail->Subject = 'PHP Server Error';
        $text = "The following error just occured:\r\nMessage: {$errorText}\r\n";
        $mail->AddAddress('ashwinib@meyersound.com');
        $mail->IsHTML(false);
        $mail->Body = $text;
        $mail->Send();
    }
}
Example #21
Show file File: function.php Project: skykain/wstmall
0
/**
 * 邮件发送函数
 * @param string to      要发送的邮箱地址
 * @param string subject 邮件标题
 * @param string content 邮件内容
 * @return array
 */
function WSTSendMail($to, $subject, $content)
{
    require_cache(VENDOR_PATH . "PHPMailer/class.smtp.php");
    require_cache(VENDOR_PATH . "PHPMailer/class.phpmailer.php");
    $mail = new PHPMailer();
    // 装配邮件服务器
    $mail->IsSMTP();
    $mail->SMTPDebug = 0;
    $mail->Host = $GLOBALS['CONFIG']['mailSmtp'];
    $mail->SMTPAuth = $GLOBALS['CONFIG']['mailAuth'];
    $mail->Username = $GLOBALS['CONFIG']['mailUserName'];
    $mail->Password = $GLOBALS['CONFIG']['mailPassword'];
    $mail->CharSet = 'utf-8';
    // 装配邮件头信息
    $mail->From = $GLOBALS['CONFIG']['mailUserName'];
    $mail->AddAddress($to);
    $mail->FromName = $GLOBALS['CONFIG']['mailSendTitle'];
    $mail->IsHTML(true);
    // 装配邮件正文信息
    $mail->Subject = $subject;
    $mail->Body = $content;
    // 发送邮件
    $rs = array();
    if (!$mail->Send()) {
        $rs['status'] = 0;
        $rs['msg'] = $mail->ErrorInfo;
        return $rs;
    } else {
        $rs['status'] = 1;
        return $rs;
    }
}
Example #22
Show file File: mail.php Project: Tschaul/waka
0
function sendmail($subject, $message, $file)
{
    $subscribers = getBelongingItemsFromDB('subscribers', '1', 'lectures');
    for ($i = 0; $i < count($subscribers); $i++) {
        $mail = new PHPMailer();
        $mail->From = "joanna.smiglak.cbi.uni-erlangen.de";
        $mail->Sender = "joanna.smiglak.cbi.uni-erlangen.de";
        $mail->FromName = "Joanna Smiglak";
        $mail->AddAddress($subscribers[$i]['address']);
        $mail->WordWrap = 50;
        // set word wrap to 50 characters
        $mail->AddAttachment($file, "Aushang.pdf");
        // optional name
        $mail->IsHTML(true);
        // set email format to HTML
        $mail->Subject = $subject;
        $mail->Body = $message;
        //$mail->AltBody = $message;
        if (!$mail->Send()) {
            echo "Message could not be sent. <p>";
            echo "Mailer Error: " . $mail->ErrorInfo;
            exit;
        }
        echo "Message has been sent to " . $subscribers[$i]['address'] . "<br>";
    }
}
Example #23
Show file File: function.php Project: sylvanasGG/tpweb
0
/**
* 
*/
function sendMail($to, $title, $content)
{
    Vendor('PHPMailer.PHPMailerAutoload');
    $mail = new PHPMailer();
    //实例化
    $mail->IsSMTP();
    // 启用SMTP
    $mail->Host = C('MAIL_HOST');
    //smtp服务器的名称(这里以QQ邮箱为例)
    $mail->SMTPAuth = C('MAIL_SMTPAUTH');
    //启用smtp认证
    $mail->Username = C('MAIL_USERNAME');
    //你的邮箱名
    $mail->Password = C('MAIL_PASSWORD');
    //邮箱密码
    $mail->From = C('MAIL_FROM');
    //发件人地址(也就是你的邮箱地址)
    $mail->FromName = C('MAIL_FROMNAME');
    //发件人姓名
    $mail->AddAddress($to, "尊敬的客户");
    $mail->WordWrap = 50;
    //设置每行字符长度
    $mail->IsHTML(C('MAIL_ISHTML'));
    // 是否HTML格式邮件
    $mail->CharSet = C('MAIL_CHARSET');
    //设置邮件编码
    $mail->Subject = $title;
    //邮件主题
    $mail->Body = $content;
    //邮件内容
    $mail->AltBody = "这是一个纯文本的身体在非营利的HTML电子邮件客户端";
    //邮件正文不支持HTML的备用显示
    return $mail->Send();
}
Example #24
Show file File: pessoaController.php Project: joshuacoddingyou/php
0
 public function sendEmail()
 {
     try {
         $time = Manager::getSysTime();
         $ipaddress = $_SERVER['REMOTE_ADDR'];
         $mail = new PHPMailer();
         $mail->IsSMTP();
         // telling the class to use SMTP
         $mail->Host = Manager::getConf('mailer.smtpServer');
         // SMTP server
         $mail->From = Manager::getConf('mailer.smtpFrom');
         $mail->FromName = Manager::getConf('mailer.smtpFromName');
         $mail->Subject = $this->data->assunto;
         $mail->isHTML(false);
         $mail->CharSet = 'utf-8';
         $body = 'Enviada de: ' . $ipaddress . ' em ' . $time;
         $mail->Body = $body . "\n" . $this->data->mensagem;
         $mail->WordWrap = 100;
         $mail->addAddress($this->data->email);
         $ok = $mail->send();
         $mail->clearAllRecipients();
         $this->renderPrompt('information', 'Mensagem enviada com sucesso!');
     } catch (Exception $e) {
         $this->renderPrompt('error', $e->getMessage());
     }
 }
Example #25
Show file File: comment.php Project: RonaLaput/Photo-Gallery
0
    public function try_to_send_notification()
    {
        $mail = new PHPMailer();
        $mail->IsSMTP();
        $mail->Host = "your.host.com";
        $mail->Port = 25;
        $mail->SMTPAuth = false;
        $mail->Username = "your_username";
        $mail->Password = "your_password";
        $mail->FromName = "Photo Gallery";
        $mail->From = "";
        $mail->AddAddress("", "Photo Gallery Admin");
        $mail->Subject = "New Photo Gallery Comment";
        $created = datetime_to_text($this->created);
        $mail->Body = <<<EMAILBODY

A new comment has been received in the Photo Gallery.

  At {$created}, {$this->author} wrote:

{$this->body}

EMAILBODY;
        $result = $mail->Send();
        return $result;
    }
Example #26
Show file File: MailAdapter.php Project: nagyist/tao-core
0
 /**
  * Initialize PHPMailer
  *
  * @access public
  * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
  * @return \PHPMailer
  */
 protected function getMailer()
 {
     $mailer = new \PHPMailer();
     $SMTPConfig = $this->getOption(self::CONFIG_SMTP_CONFIG);
     $mailer->IsSMTP();
     $mailer->SMTPKeepAlive = true;
     $mailer->Debugoutput = 'error_log';
     $mailer->Host = $SMTPConfig['SMTP_HOST'];
     $mailer->Port = $SMTPConfig['SMTP_PORT'];
     $mailer->Username = $SMTPConfig['SMTP_USER'];
     $mailer->Password = $SMTPConfig['SMTP_PASS'];
     if (isset($SMTPConfig['DEBUG_MODE'])) {
         $mailer->SMTPDebug = $SMTPConfig['DEBUG_MODE'];
     }
     if (isset($SMTPConfig['Mailer'])) {
         $mailer->Mailer = $SMTPConfig['Mailer'];
     }
     if (isset($SMTPConfig['SMTP_AUTH'])) {
         $mailer->SMTPAuth = $SMTPConfig['SMTP_AUTH'];
     }
     if (isset($SMTPConfig['SMTP_SECURE'])) {
         $mailer->SMTPSecure = $SMTPConfig['SMTP_SECURE'];
     }
     return $mailer;
 }
Example #27
Show file File: Mail.php Project: ashmna/MedDocs
0
 public static function syncDictionaryItem(\PHPMailer $mail, $keyName, $lang = '', array $params = [])
 {
     $app = App::getInstance();
     /** @var \MD\DAO\Dictionary $dictionaryDAO */
     $dictionaryDAO = $app->container->get('MD\\DAO\\Dictionary');
     $config = Config::getInstance();
     if (empty($lang)) {
         $lang = $config->currentLocale;
     }
     $params['name'] = $config->partnerName;
     $params['url'] = $config->getPartnerSiteUrl();
     $params['affiliateUrl'] = $config->partnerUrl;
     $params1 = [];
     foreach ($params as $key => $value) {
         $params1['{' . $key . '}'] = $value;
     }
     $params = $params1;
     $dictionary = $dictionaryDAO->getDictionaryItem($keyName, $lang);
     if (isset($dictionary)) {
         $mail->isHTML(true);
         $mail->Subject = strtr($dictionary->title, $params);
         $mail->Body = strtr($dictionary->content, $params);
     }
     return $mail;
 }
Example #28
Show file File: notificacionEstadiaDosMesesTask.class.php Project: abdocmd/spmillen
0
 protected function execute($arguments = array(), $options = array())
 {
     $con = $this->crearConexion();
     try {
         $record = Doctrine::getTable('EmailConfiguration')->findAll()->getFirst();
         $config_mail = array('charset' => 'UTF-8', 'encryption' => $record->getSmtpSecurityType(), 'host' => $record->getSmtpHost(), 'port' => $record->getSmtpPort(), 'username' => $record->getSmtpUsername(), 'password' => $record->getSmtpPassword(), 'authentication' => $record->getSmtpAuthType());
         $mail = new PHPMailer();
         $mail->IsSMTP();
         $mail->CharSet = $config_mail['charset'];
         if ($config_mail['authentication'] == "login") {
             $mail->SMTPAuth = true;
         }
         if ($config_mail['encryption'] == "tls") {
             $mail->SMTPSecure = "tls";
         }
         if ($config_mail['encryption'] == "ssl") {
             $mail->SMTPSecure = "ssl";
         }
         $mail->Host = $config_mail['host'];
         $mail->Port = $config_mail['port'];
         $mail->Username = $config_mail['username'];
         $mail->Password = $config_mail['password'];
         $mail->FromName = 'Mi company';
         $mail->From = $config_mail['username'];
         //email de remitente desde donde se env?a el correo
         $mail->AddAddress($config_mail['username'], 'Destinatario');
         //destinatario que va a recibir el correo
         $mail->Subject = "confeccion de gafete";
         /*Recojemos los datos del oficial*/
         $dao = new EmployeeDao();
         $employeeList = $dao->getEmployeeList();
         foreach ($employeeList as $employee) {
             if ($employee->getJoinedDate() != "") {
                 $datetime1 = new DateTime($employee->getJoinedDate());
                 $datetime2 = new DateTime(date('y-m-d', time()));
                 $formato = $datetime2->format('y-m-d');
                 $intervalo = $datetime1->diff($datetime2, true);
                 if ($intervalo->m == 2 && $intervalo->d == 0) {
                     $html = "Identificador: " . $employee->getEmployeeId() . "<br/>";
                     $html .= "ID: " . $employee->getOtherId() . "<br/>";
                     $html .= "Nombre      : " . utf8_encode($employee->getFullName()) . "<br/>";
                     $html .= "Fecha Nac   : " . $employee->getEmpBirthday() . "<br/>";
                     $sexo = $employee->getEmpGender() == 1 ? "Masculino" : "Femenino";
                     $html .= "G&eacute;nero      : " . $sexo . "<br/>";
                     $html .= "Nacionalidad: " . $employee->getNationality() . "<br/>";
                     $html .= "M&oacute;vil: " . $employee->getEmpMobile() . "<br/>";
                     $mail->MsgHTML($html);
                     if (!$mail->Send()) {
                         $this->escribirYML('log_tareas', false, $mail->ErrorInfo . " Error al enviar el correo  con los datos del empleado " . $employee->getFullName());
                     } else {
                         $this->escribirYML('log_tareas', true, "correo enviado  con los datos del empleado " . $employee->getFullName());
                     }
                 }
             }
         }
         Doctrine_Manager::getInstance()->closeConnection($con);
     } catch (Exception $e) {
         $this->escribirYML('log_tareas', false, $e->getMessage());
     }
 }
Example #29
Show file File: email.php Project: laiello/wenderpereira
0
       function smtpmailer($para, $de, $de_nome, $assunto, $corpo)
       {
           global $error;
           $mail = new PHPMailer();
           $mail->IsSMTP();
           // Ativar SMTP
           $mail->SMTPDebug = 0;
           // Debugar: 1 = erros e mensagens, 2 = mensagens apenas
           $mail->SMTPAuth = true;
           // Autenticação ativada
           $mail->SMTPSecure = 'ssl';
           // SSL REQUERIDO pelo GMail
           $mail->Host = 'smtp.gmail.com';
           // SMTP utilizado
           $mail->Port = 465;
           // A porta 465 deverá estar aberta em seu servidor
           $mail->Username = GUSER;
           $mail->Password = GPWD;
           $mail->SetFrom($de, $de_nome);
           $mail->Subject = $assunto;
           $mail->Body = $corpo;
           $mail->AddAddress($para);
           if (!$mail->Send()) {
               $error = 'Mail error: ' . $mail->ErrorInfo;
               return false;
           } else {
               ?>
  <script>
	alert("Cadastro realizado com sucesso acesse seu email e ative o usuário!");
	window.location = 'index.php';
  </script>
	<?php 
               return true;
           }
       }
Example #30
Show file File: functions.php Project: NemOry/EpicueWebPanel
0
function send_email($send_to, $subject, $body, $from_name, $from_email)
{
    if (!empty($send_to) && !empty($subject) && !empty($body)) {
        $mail = new PHPMailer();
        $mail->IsSMTP();
        $mail->SMTPDebug = 1;
        $mail->SMTPAuth = true;
        $mail->SMTPSecure = 'ssl';
        $mail->Host = "universe1.southbankdomains.com";
        $mail->Port = 465;
        $mail->Priority = 1;
        $mail->FromName = $from_name;
        $mail->Username = EMAIL_ADDRESS;
        $mail->Password = EMAIL_PASS;
        $mail->From = $from_email;
        $mail->AddAddress($send_to);
        // for publishing
        $mail->Subject = $subject;
        $mail->Body = $body;
        $mail->WordWrap = 50;
        if (!$mail->Send()) {
            echo 'Message was not sent.';
            echo 'Mailer error: ' . $mail->ErrorInfo;
        } else {
            //echo 'Message has been sent.';
        }
    } else {
        echo "All email components are required.";
    }
}
Frequently Used Methods