PHPMailer PHP Class Code Examples

This page contains top rated real world PHP examples of class PHPMailer extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: mail.php Project: espixxl/topguay
1
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 #2
Show file File: function.php Project: iceprosurface/PostorManagerSystem
1
/**
 * 邮件发送函数
 */
function sendMail($to, $subject, $content)
{
    Vendor('PHPMailer.PHPMailerAutoload');
    $mail = new PHPMailer();
    // 装配邮件服务器
    if (C('MAIL_SMTP')) {
        $mail->IsSMTP();
    }
    $mail->Host = C('MAIL_HOST');
    $mail->SMTPAuth = C('MAIL_SMTPAUTH');
    $mail->Username = C('MAIL_USERNAME');
    $mail->Password = C('MAIL_PASSWORD');
    $mail->SMTPSecure = C('MAIL_SECURE');
    $mail->CharSet = C('MAIL_CHARSET');
    // 装配邮件头信息
    $mail->From = C('MAIL_USERNAME');
    $mail->AddAddress($to);
    $mail->FromName = '快件管理中心';
    $mail->IsHTML(C('MAIL_ISHTML'));
    // 装配邮件正文信息
    $mail->Subject = $subject;
    $mail->Body = $content;
    // 发送邮件
    if (!$mail->Send()) {
        return FALSE;
    } else {
        return TRUE;
    }
}
Example #3
Show file File: PHPMailer.php Project: rb26/zenphoto
0
function zenphoto_PHPMailer($msg, $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses, $replyTo)
{
    require_once dirname(__FILE__) . '/PHPMailer/class.phpmailer.php';
    switch (getOption('PHPMailer_mail_protocol')) {
        case 'pop3':
            require_once dirname(__FILE__) . '/PHPMailer/class.pop3.php';
            $pop = new POP3();
            $authorized = $pop->Authorise(getOption('PHPMailer_server'), getOption('PHPMailer_pop_port'), 30, getOption('PHPMailer_user'), getOption('PHPMailer_password'), 0);
            $mail = new PHPMailer();
            $mail->IsSMTP();
            $mail->Port = getOption('PHPMailer_smtp_port');
            $mail->Host = getOption('PHPMailer_server');
            break;
        case 'smtp':
            $mail = new PHPMailer();
            $mail->SMTPAuth = true;
            // enable SMTP authentication
            $mail->IsSMTP();
            $mail->Username = getOption('PHPMailer_user');
            $mail->Password = getOption('PHPMailer_password');
            $mail->Host = getOption('PHPMailer_server');
            $mail->Port = getOption('PHPMailer_smtp_port');
            break;
        case 'sendmail':
            $mail = new PHPMailer();
            $mail->IsSendmail();
            break;
    }
    $mail->SMTPSecure = getOption('PHPMailer_secure');
    $mail->CharSet = 'UTF-8';
    $mail->From = $from_mail;
    $mail->FromName = $from_name;
    $mail->Subject = $subject;
    $mail->Body = $message;
    $mail->AltBody = '';
    $mail->IsHTML(false);
    foreach ($email_list as $to_name => $to_mail) {
        if (is_numeric($to_name)) {
            $mail->AddAddress($to_mail);
        } else {
            $mail->AddAddress($to_mail, $to_name);
        }
    }
    if (count($cc_addresses) > 0) {
        foreach ($cc_addresses as $cc_name => $cc_mail) {
            $mail->AddCC($cc_mail);
        }
    }
    if ($replyTo) {
        $names = array_keys($replyTo);
        $mail->AddReplyTo(array_shift($replyTo), array_shift($names));
    }
    if (!$mail->Send()) {
        if (!empty($msg)) {
            $msg .= '<br />';
        }
        $msg .= sprintf(gettext('<code>PHPMailer</code> failed to send <em>%1$s</em>. ErrorInfo:%2$s'), $subject, $mail->ErrorInfo);
    }
    return $msg;
}
Example #4
Show file File: mail.class.php Project: Woems/TerminGrul
0
 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();
 }
Example #5
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 #6
Show file File: add.php Project: louk/One-Nice-Thing
0
function sendmail($user, $message)
{
    $body = $message;
    date_default_timezone_set('Etc/UTC');
    $mail = new PHPMailer();
    $mail->isSMTP();
    //      $mail->SMTPDebug = 2;
    $mail->Debugoutput = 'html';
    $mail->Host = '1nicethingnet.domain.com';
    $mail->Port = 587;
    $mail->SMTPSecure = '';
    $mail->SMTPAuth = true;
    $mail->Username = "info@1nicething.net";
    $mail->Password = "1Nicething";
    $mail->setFrom('info@1nicething.net', 'One Nice Thing');
    $mail->addAddress($user, 'Customer');
    $mail->Subject = "";
    $mail->msgHTML($body);
    $mail->AltBody = '';
    $mail->send();
    //if (!$mail->send()) {
    //    echo "Mailer Error: " . $mail->ErrorInfo;
    //} else {
    //    echo "Message sent!";
    //}
}
Example #7
Show file File: Send_Mail.php Project: ed-ro0t/Cryptsy-Clone
0
function Send_Mail($to, $subject, $body)
{
    require './class.phpmailer.php';
    $from = "admin@crypto-maniac.com";
    $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 = "admin@crypto-maniac.com";
    // SES SMTP  username
    $mail->Password = "smtppass123smtp2014";
    // 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;
    }
}
Example #8
Show file File: funcoes.php Project: cristianobertolini/ProjetoCTA
0
function smtpmailer($para, $de, $de_nome, $assunto, $corpo, $tipo)
{
    if ($tipo == 0) {
        include "./phpmailer/class.phpmailer.php";
    } else {
        include "../phpmailer/class.phpmailer.php";
    }
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->IsHTML(true);
    $mail->SMTPDebug = 1;
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = 'ssl';
    $mail->Host = "smtp.gmail.com";
    $mail->Port = 465;
    $mail->Username = "gerenciador.tgsi@gmail.com";
    $mail->Password = "testegerenciador";
    $mail->SetFrom($de, $de_nome);
    $mail->Subject = $assunto;
    $mail->Body = $corpo;
    $mail->AddAddress($para);
    if (!$mail->Send()) {
        $erro = 'Erro: ' . $mail->ErrorInfo;
        return $erro;
    } else {
        return 'Informações enviadas para o seu e-mail!';
    }
}
Example #9
Show file File: C_Prescription.class.php Project: sivarajankumar/openemr
0
 function _email_prescription($p, $email)
 {
     if (empty($email)) {
         $this->assign("process_result", "Email could not be sent, the address supplied: '{$email}' was empty or invalid.");
         return;
     }
     require $GLOBALS['fileroot'] . "/library/classes/class.phpmailer.php";
     $mail = new PHPMailer();
     $mail->SetLanguage("en", $GLOBALS['fileroot'] . "/library/");
     //this is a temporary config item until the rest of the per practice billing settings make their way in
     $mail->From = $GLOBALS['practice_return_email_path'];
     $mail->FromName = $p->provider->get_name_display();
     $mail->isMail();
     $mail->Host = "localhost";
     $mail->Mailer = "mail";
     $text_body = $p->get_prescription_display();
     $mail->Body = $text_body;
     $mail->Subject = "Prescription for: " . $p->patient->get_name_display();
     $mail->AddAddress($email);
     if ($mail->Send()) {
         $this->assign("process_result", "Email was successfully sent to: " . $email);
         return;
     } else {
         $this->assign("process_result", "There has been a mail error sending to " . $_POST['email_to'] . " " . $mail->ErrorInfo);
         return;
     }
 }
Example #10
Show file File: CommonAction.class.php Project: caotieshuan/ishoutou
0
 /**
  * 发送邮件 支持批量发送
  * @param string|array $to 收件人
  * @param string $subject 主题
  * @param string $body 内容
  * @param string $cc 抄送
  * @param string $bcc 秘密抄送
  * @return boolean
  */
 private function _send_mail($to, $subject, $body, $cc = '', $bcc = '')
 {
     $msgconfig = FS("Webconfig/msgconfig");
     $gc = get_global_setting();
     vendor('/PHPMailer/smtp');
     vendor('/PHPMailer/phpmailer');
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->IsHTML(true);
     $mail->addCC($cc);
     $mail->addBCC($bcc);
     $mail->CharSet = 'utf-8';
     $mail->SMTPAuth = true;
     $mail->Host = $msgconfig['stmp']['server'];
     $mail->Username = $msgconfig['stmp']['user'];
     $mail->Password = $msgconfig['stmp']['pass'];
     $mail->From = $msgconfig['stmp']['user'];
     $mail->FromName = $gc['web_name'];
     $mail->Subject = $subject;
     $mail->Body = $body;
     if (is_array($to)) {
         $mail->AddAddress($to[0]);
         array_shift($to);
         foreach ($to as $um) {
             $mail->addBCC($um);
         }
     } else {
         $mail->AddAddress($to);
     }
     return $mail->Send();
 }
Example #11
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 #12
Show file File: emails.php Project: kosmoluna/question2answer
0
function qa_send_email($params)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    //	@error_log(print_r($params, true));
    require_once QA_INCLUDE_DIR . 'vendor/PHPMailer/PHPMailerAutoload.php';
    $mailer = new PHPMailer();
    $mailer->CharSet = 'utf-8';
    $mailer->From = $params['fromemail'];
    $mailer->Sender = $params['fromemail'];
    $mailer->FromName = $params['fromname'];
    $mailer->AddAddress($params['toemail'], $params['toname']);
    $mailer->Subject = $params['subject'];
    $mailer->Body = $params['body'];
    if ($params['html']) {
        $mailer->IsHTML(true);
    }
    if (qa_opt('smtp_active')) {
        $mailer->IsSMTP();
        $mailer->Host = qa_opt('smtp_address');
        $mailer->Port = qa_opt('smtp_port');
        if (qa_opt('smtp_secure')) {
            $mailer->SMTPSecure = qa_opt('smtp_secure');
        }
        if (qa_opt('smtp_authenticate')) {
            $mailer->SMTPAuth = true;
            $mailer->Username = qa_opt('smtp_username');
            $mailer->Password = qa_opt('smtp_password');
        }
    }
    return $mailer->Send();
}
Example #13
Show file File: UsersAction.class.php Project: fengsmith1988/weixin-1
0
 public function regSendEmail($host, $port, $emailuser, $emailpassword, $FromName = '管理员', $Subject, $body, $to_email)
 {
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->Host = $host;
     $mail->SMTPDebug = '0';
     $mail->SMTPAuth = true;
     $mail->CharSet = "UTF-8";
     //字符集
     $mail->Encoding = "base64";
     //编码方式
     $mail->Port = $port;
     $mail->Username = $emailuser;
     $mail->Password = $emailpassword;
     $mail->From = $emailuser;
     // 发件人邮箱
     $mail->FromName = "=?utf-8?B?" . base64_encode($FromName) . "?=";
     // 发件人
     $mail->Subject = "=?UTF-8?B?" . base64_encode($Subject) . "?=";
     $mail->IsHTML(true);
     // send as HTML
     $mail->MsgHTML($body);
     $mail->AddAddress($to_email);
     return $mail->Send();
 }
Example #14
Show file File: ~runtime.php Project: lz1988/lejing
0
function sendmail($address, $subject, $body, $altbody = '请使用兼容HTML格式邮箱.')
{
    vendor('PHPMailer_5_2_1.class#phpmailer');
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->CharSet = 'UTF-8';
    $mail->Host = C('LEG_MAIL_HOST');
    $mail->Port = C('LEG_MAIL_PORT');
    $mail->SMTPAuth = true;
    $mail->Username = C('LEG_MAIL_USERNAME');
    $mail->Password = C('LEG_MAIL_PASSWORD');
    $mail->From = C('LEG_MAIL_ADDRESS_FROM');
    $mail->FromName = C('LEG_MAIL_ADDRESS_FROM_NAME');
    if (is_array($address)) {
        foreach ($address as $val) {
            $mail->AddAddress($val);
        }
    } else {
        $mail->AddAddress($address);
    }
    $mail->AddReplyTo(C('LEG_MAIL_ADDRESS_FROM'), C('LEG_MAIL_ADDRESS_FROM_NAME'));
    $mail->WordWrap = C('LEG_MAIL_WORD_WRAP_SIZE');
    $mail->IsHTML(C('LEG_MAIL_IS_HTML'));
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->AltBody = $altbody;
    if (!$mail->Send()) {
        return false;
    } else {
        return true;
    }
}
Example #15
Show file File: registrierung.php Project: FridgeProduction/OpenSoccer
0
function email_senden($email, $username, $password)
{
    $empfaenger = $email;
    $betreff = CONFIG_SITE_NAME . ': Willkommen';
    $nachricht = "Hallo " . $username . ",\n\nDu hast Dich erfolgreich auf " . CONFIG_SITE_DOMAIN . " registriert. Bitte logge Dich jetzt mit Deinen Benutzerdaten ein, um Deinen Account zu aktivieren. Und dann kann es auch schon losgehen ...\n\nDamit Du Dich anmelden kannst, findest Du hier noch einmal Deine Benutzerdaten:\n\nE-Mail: " . $email . "\nBenutzername: " . $username . "\nPasswort: " . $password . "\n\nWir wünschen Dir noch viel Spaß beim Managen!\n\nSportliche Grüße\n" . CONFIG_SITE_NAME . "\n" . CONFIG_SITE_DOMAIN . "\n\n------------------------------\n\nDu erhältst diese E-Mail, weil Du Dich auf " . CONFIG_SITE_DOMAIN . " mit dieser Adresse registriert hast. Du kannst Deinen Account jederzeit löschen, nachdem Du Dich eingeloggt hast, sodass Du anschließend keine E-Mails mehr von uns bekommst. Bei Missbrauch Deiner E-Mail-Adresse meldest Du Dich bitte per E-Mail unter " . CONFIG_SITE_EMAIL;
    if (CONFIG_EMAIL_PHP_MAILER) {
        require './phpmailer/PHPMailerAutoload.php';
        $mail = new PHPMailer();
        // create a new object
        $mail->CharSet = CONFIG_EMAIL_CHARSET;
        $mail->IsSMTP();
        $mail->SMTPAuth = CONFIG_EMAIL_AUTH;
        $mail->SMTPSecure = CONFIG_EMAIL_SECURE;
        $mail->Host = CONFIG_EMAIL_HOST;
        $mail->Port = CONFIG_EMAIL_PORT;
        $mail->Username = CONFIG_EMAIL_USER;
        $mail->Password = CONFIG_EMAIL_PASS;
        $mail->SetFrom(CONFIG_EMAIL_FROM, CONFIG_SITE_NAME);
        $mail->Subject = $betreff;
        $mail->Body = $nachricht;
        $mail->AddAddress($empfaenger);
        $mail->Send();
    } else {
        $header = "From: " . CONFIG_SITE_NAME . " <" . CONFIG_SITE_EMAIL . ">\r\nContent-type: text/plain; charset=utf-8";
        mail($empfaenger, $betreff, $nachricht, $header);
    }
}
Example #16
Show file File: Mail.php Project: liu33851861/CZD_Yaf_Extension
0
 private static function getTransport()
 {
     if (defined('SMTP_SERVER') && defined('SMTP_SSL') && defined('SMTP_USERNAME') && defined('SMTP_PASSWORD')) {
         $mailer = new PHPMailer();
         $mailer->IsSMTP();
         $mailer->Host = SMTP_SERVER;
         $mailer->SMTPAuth = SMTP_SSL;
         if (SMTP_SSL) {
             $mailer->SMTPSecure = 'ssl';
             $mailer->Port = 465;
         } else {
             $mailer->Port = 25;
         }
         //$mailer->SMTPDebug=true;
         $mailer->CharSet = 'UTF-8';
         $mailer->Username = SMTP_USERNAME;
         $mailer->Password = SMTP_PASSWORD;
         if (defined('SMTP_HELO')) {
             $mailer->Helo = SMTP_HELO;
         }
         return $mailer;
     } else {
         throw new Exception('Can\'t find SMTP configuration');
     }
 }
Example #17
Show file File: GeneralFunctions.php Project: sonicmaster/RPG
0
function MailSend($MailTarget, $MailTargetName, $MailSubject, $MailContent)
{
    global $CONF;
    require_once './includes/classes/class.phpmailer.php';
    $mail = new PHPMailer(true);
    if ($CONF['mail_use'] == 2) {
        $mail->IsSMTP();
        $mail->SMTPAuth = true;
        $mail->SMTPSecure = $CONF['smtp_ssl'];
        $mail->Host = $CONF['smtp_host'];
        $mail->Port = $CONF['smtp_port'];
        $mail->Username = $CONF['smtp_user'];
        $mail->Password = $CONF['smtp_pass'];
        $mail->SMTPDebug = $CONF['debug'] == 1 ? 2 : 0;
    } elseif ($CONF['mail_use'] == 1) {
        $mail->IsSendmail();
        $mai->Sendmail = $CONF['smail_path'];
    } else {
        $mail->IsMail();
    }
    $mail->CharSet = 'UTF-8';
    $mail->IsHTML(true);
    $mail->Subject = $MailSubject;
    $mail->AltBody = strip_tags($MailContent);
    $mail->SetFrom($CONF['smtp_sendmail'], $CONF['game_name']);
    $mail->AddAddress($MailTarget, $MailTargetName);
    $mail->MsgHTML(makebr($MailContent));
    $mail->Send();
}
Example #18
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 #19
Show file File: sendmail.php Project: baothaklien/Project3
0
 function smtpmailer($to, $from, $from_name, $subject, $body)
 {
     global $error;
     $mail = new PHPMailer();
     // tạo một đối tượng mới từ class PHPMailer
     $mail->IsSMTP();
     // bật chức năng SMTP
     $mail->SMTPDebug = 0;
     // kiểm tra lỗi : 1 là  hiển thị lỗi và thông báo cho ta biết, 2 = chỉ thông báo lỗi
     $mail->SMTPAuth = true;
     // bật chức năng đăng nhập vào SMTP này
     $mail->SMTPSecure = 'ssl';
     // sử dụng giao thức SSL vì gmail bắt buộc dùng cái này
     $mail->Host = 'smtp.gmail.com';
     $mail->Port = 465;
     $mail->Username = GUSER;
     $mail->Password = GPWD;
     $mail->SetFrom($from, $from_name);
     $mail->Subject = $subject;
     $mail->Body = $body;
     $mail->AddAddress($to);
     if (!$mail->Send()) {
         $error = 'Gửi mail bị lỗi: ' . $mail->ErrorInfo;
         return false;
     } else {
         $error = 'Thư của bạn đã được gửi đi ';
         return true;
     }
 }
Example #20
Show file File: req-cv.php Project: zfadade/cmform
0
function setupMailHeader()
{
    echo 'Hello from setupMailHeader()' . "<br>";
    require 'vendor/autoload.php';
    require_once 'includes/config.php';
    echo 'Instantiating new PHPMailer' . "<br>";
    $mail = new PHPMailer();
    echo 'Instantiated !' . "<br>";
    //$mail->SMTPDebug = 3;                               // 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 = $my_init_data['cmform_smtp_username'];
    // SMTP username
    $mail->Password = $my_init_data['cmform_smtp_password'];
    // SMTP password
    $mail->SMTPSecure = 'tls';
    // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;
    // TCP port to connect to
    $mail->isHTML(true);
    // Set email format to HTML
    $mail->setFrom($my_init_data['cmform_from_email'], 'MyCompany');
    $mail->addReplyTo($my_init_data['cmform_replyto_email'], 'Contact');
    $mail->addBCC($my_init_data['cmform_bcc_email']);
    return $mail;
}
Example #21
Show file File: sd.class.Order.php Project: pankajit/carumba
0
 function sendReply()
 {
     global $authenticationMgr;
     $orderID = _post('orderID');
     $reply = _post('reply');
     $order = $this->getOrder($orderID);
     $userData = $authenticationMgr->getUserData($order['userID'], '');
     $mail = new PHPMailer();
     $mail->IsSMTP();
     // set mailer to use SMTP
     $mail->Host = "localhost";
     // specify main and backup server
     $mail->SMTPAuth = true;
     // turn on SMTP authentication
     $mail->Username = "robot@carumba.ru";
     // SMTP username
     $mail->Password = "Vifi2Ht6b";
     // SMTP password
     $mail->From = 'robot@carumba.ru';
     $mail->FromName = 'Carumba.ru';
     $mail->WordWrap = 50;
     // set word wrap to 50 characters
     $mail->IsHTML(true);
     // set email format to HTML
     $mail->Subject = 'Ответ на заказ carumba.ru';
     $mail->Body = $reply;
     $mail->AddAddress($userData['Email'], $userData['LastName'] . ' ' . $userData['FirstName']);
     if (!$mail->Send()) {
         trigger_error('Message could not be sent.Mailer Error: ' . $mail->ErrorInfo, PM_FATAL);
     } else {
         $query = "INSERT INTO pm_order_message (orderID, message, dateOfMes) VALUES ('" . $orderID . "', '" . $reply . "', '" . date("Y-m-d H:i:s") . "')";
         mysql_query($query);
     }
     header('location: /carorders?cmd=orders&act=viewReplies&orderID=' . $orderID);
 }
Example #22
Show file File: PHPLogin.php Project: php-joe/FloraRetriever
0
 /**
  * Create a PHPMailer Object with configuration of config.php
  * @return PHPMailer Object
  */
 private function getPHPMailerObject()
 {
     require_once __DIR__ . '/libraries/PHPMailer.php';
     $mail = new PHPMailer();
     // please look into the config/config.php for much more info on how to use this!
     // use SMTP or use mail()
     if (EMAIL_USE_SMTP) {
         require_once __DIR__ . '/libraries/SMTP.php';
         // Set mailer to use SMTP
         $mail->IsSMTP();
         //useful for debugging, shows full SMTP errors
         //$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
         // Enable SMTP authentication
         $mail->SMTPAuth = EMAIL_SMTP_AUTH;
         // Enable encryption, usually SSL/TLS
         if (defined(EMAIL_SMTP_ENCRYPTION)) {
             $mail->SMTPSecure = EMAIL_SMTP_ENCRYPTION;
         }
         // Specify host server
         $mail->Host = EMAIL_SMTP_HOST;
         $mail->Username = EMAIL_SMTP_USERNAME;
         $mail->Password = EMAIL_SMTP_PASSWORD;
         $mail->Port = EMAIL_SMTP_PORT;
     } else {
         $mail->IsMail();
     }
     return $mail;
 }
Example #23
Show file File: SendingEmail.php Project: hotkongzaa/gogetrich
0
 public function sendingEmail()
 {
     $mail = new PHPMailer(true);
     $mail->CharSet = "UTF-8";
     $mail->IsSMTP();
     // set mailer to use SMTP
     $mail->Host = $this->host;
     // specify main and backup server
     $mail->SMTPAuth = true;
     // turn on SMTP authentication
     $mail->Username = $this->username;
     // SMTP username
     $mail->Password = $this->password;
     // SMTP password
     $mail->From = $this->from;
     $mail->FromName = $this->fromName;
     $mail->AddAddress($this->addressTo);
     $mail->IsHTML(true);
     // set email format to HTML
     $mail->Subject = $this->subJectName;
     $mail->Body = $this->emailBody;
     if (!$mail->Send()) {
         return "Message could not be sent. <p> Mailer Error: " . $mail->ErrorInfo;
     } else {
         return 200;
     }
 }
Example #24
Show file File: functions.php Project: nitikarn5990/testtoday
0
 function sentMail($frommail, $tomail, $title, $html, $cc = "", $bcc = "", $atk = "")
 {
     require_once 'class.phpmailer.php';
     $mail = new PHPMailer(true);
     //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch
     $mail->CharSet = 'UTF-8';
     try {
         $mail->SetFrom($frommail, "exchangercoin.com");
         $mail->AddAddress($tomail);
         if ($cc != "") {
             $mail->AddCC($cc);
         }
         if ($bcc != "") {
             $mail->AddBCC($bcc);
         }
         $mail->Subject = $title;
         $mail->MsgHTML($html);
         if ($atk != "") {
             $mail->AddAttachment($atk);
         }
         // attachment
         $mail->Send();
         echo "Message Sent OK<p></p>\n";
     } catch (phpmailerException $e) {
         echo $e->errorMessage();
         //Pretty error messages from PHPMailer
     } catch (Exception $e) {
         echo $e->getMessage();
         //Boring error messages from anything else!
     }
 }
Example #25
Show file File: thegameController.php Project: sunhaynhucho/Loser
0
 private function sendmail($mailname, $mailaddress, $mailpass, $mailcontent, $mailsubject, $mailhost, $mailport, $mailto, $mailnameto)
 {
     date_default_timezone_set('Etc/UTC');
     require __SITE_PATH . '/includes/PHPMailerAutoload.php';
     $mail = new PHPMailer();
     $mail->isSMTP();
     $mail->SMTPDebug = 0;
     $mail->Debugoutput = 'html';
     $mail->Host = $mailhost;
     $mail->Port = $mailport;
     $mail->SMTPSecure = 'tls';
     $mail->SMTPAuth = true;
     $mail->Username = $mailaddress;
     $mail->Password = $mailpass;
     $mail->setFrom($mailaddress, $mailname);
     $mail->addReplyTo($mailaddress, $mailname);
     $mail->addAddress($mailto, $mailnameto);
     $mail->Subject = $mailsubject;
     $mail->msgHTML(file_get_contents($mailcontent), dirname(__FILE__));
     $mail->CharSet = 'utf-8';
     if (!$mail->send()) {
         return false;
     } else {
         return true;
     }
 }
Example #26
Show file File: functions.php Project: ernesto9695/Test
0
function send_mail($receiver_email, $receiver_name, $message = [])
{
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->Mailer = 'smtp';
    $mail->SMTPAuth = true;
    $mail->Host = 'smtp.gmail.com';
    // "ssl://smtp.gmail.com" didn't worked
    //$mail->Port = 465;
    //$mail->SMTPSecure = 'ssl';
    // or try these settings (worked on XAMPP and WAMP):
    $mail->Port = 587;
    $mail->SMTPSecure = 'tls';
    $mail->Username = "michelkamdem222@gmail.com";
    $mail->Password = "michel222";
    $mail->IsHTML(true);
    // if you are going to send HTML formatted emails
    //$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.
    $mail->From = "michelkamdem@gmail.com";
    $mail->FromName = "Michel Kamdem";
    $mail->addAddress($receiver_email, $receiver_name);
    //$mail->addAddress("user.2@gmail.com","User 2");
    //$mail->addCC("user.3@ymail.com","User 3");
    //$mail->addBCC("user.4@in.com","User 4");
    $mail->Subject = $message['subject'];
    $mail->Body = $message['body'];
    return $mail->Send();
}
Example #27
Show file File: ContactUs.php Project: vongkol/sunbusiness
0
 public function sendEmail($smtp, $port, $username, $password, $to, $sub, $sms)
 {
     // create a new mail object
     $mail = new PHPMailer();
     // enable SMTP
     $mail->IsSMTP();
     // debugging: 1 = errors and messages, 2 = messages only
     $mail->SMTPDebug = 0;
     // authentication enabled
     $mail->SMTPAuth = true;
     // secure transfer enabled REQUIRED for GMail
     $mail->SMTPSecure = 'ssl';
     $mail->Host = $smtp;
     $mail->Port = $port;
     $mail->IsHTML(true);
     $mail->Username = $username;
     $mail->Password = $password;
     $mail->SetFrom($username);
     $mail->Subject = $sub;
     $mail->Body = $sms;
     // send to email address
     $mail->AddAddress($to);
     $sms = "";
     if (!$mail->Send()) {
         $sms = "Cannot send your message.";
     } else {
         $sms = "Your message has been sent.";
     }
     return $sms;
 }