本文整理汇总了PHP中PHPMailer::IsSMTP方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::IsSMTP方法的具体用法?PHP PHPMailer::IsSMTP怎么用?PHP PHPMailer::IsSMTP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::IsSMTP方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
public function handle($fromTitle, $fromMail, $toEmail, $subject, $body, $attachments, $smtpHost, $smtpPort, $serverLogin = '', $serverPassword = '', $charCode = 'UTF-8', $isHtml = false)
{
if (!is_object($this->_mail)) {
$this->_mail = new PHPMailer();
}
$this->_mail->CharSet = $charCode;
$this->_mail->IsHTML($isHtml);
$this->_mail->From = $fromMail;
$this->_mail->FromName = $fromTitle;
$this->_mail->AddReplyTo($fromMail, $fromTitle);
$this->_mail->Subject = $subject;
$this->_mail->Body = $body;
$this->_mail->AltBody = '';
$this->_mail->AddAddress($toEmail, '');
$this->_mail->IsSMTP(true);
$this->_mail->Mailer = 'smtp';
$this->_mail->Host = $smtpHost;
$this->_mail->Port = $smtpPort;
if ($serverLogin != '') {
$this->_mail->SMTPAuth = true;
$this->_mail->Username = $serverLogin;
$this->_mail->Password = $serverPassword;
} else {
$this->_mail->SMTPAuth = false;
$this->_mail->Username = '';
$this->_mail->Password = '';
}
if (is_object($attachments)) {
//FIXME
// // zalaczniki
//for ($z = 0; $z < Count($tab_mail_oma_zalacznik[$tab_mail_id[$i]]); $z++) {
//if (($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z] != '') AND (file_exists($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]))) {
//if ($tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] == '') {
//$this->_mail->AddAttachment($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], basename($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]));
//} // koniec if...
//else {
//$this->_mail->AddEmbeddedImage($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z]);
//$tmp_tresc = str_replace('[' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] . ']', 'cid:' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z], $tmp_tresc);
//} // koniec else...
//} // koniec if...
//} // koniec for...
}
if (!$this->_mail->Send()) {
$status = false;
} else {
$status = true;
}
$this->_mail->ClearAddresses();
$this->_mail->ClearAttachments();
return $status;
}
示例2: EmailError
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();
}
}
示例3: sendMail
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;
}
}
示例4: carregar
/**
* Método para carregar o objeto PHPMailer
* @return \PHPMailer
*/
public function carregar() {
$dados = \controlador\Facil::getDadosIni();
require(LIB . DS . "PHPMailer/class.phpmailer.php");
$this->mailer = new \PHPMailer();
if ($dados['email']['smtp']) {
$this->mailer->IsSMTP();
$this->mailer->Host = $dados['email']['host'];
$this->mailer->SMTPAuth = $dados['email']['autenticar'];
$this->mailer->Username = $dados['email']['usuario'];
$this->mailer->Password = $dados['email']['senha'];
}
$this->mailer->From = $dados['email']['from_email'];
$this->mailer->FromName = $dados['email']['from_nome'];
$this->mailer->IsHTML($dados['email']['html']);
$this->mailer->WordWrap = $dados['email']['wordwrap'];
$this->mailer->AddReplyTo($this->mailer->From);
$this->mailer->CharSet = $dados['l10n']['charset'];
return $this->mailer;
}
示例5: initPHPMailer
/**
* Initializes the PHPMailer.
* @return true
*/
private static function initPHPMailer()
{
self::$_mailer = new PHPMailer();
self::$_mailer->IsSMTP();
self::$_mailer->Host = Yii::app()->params['mailHost'];
self::$_mailer->SMTPAuth = true;
self::$_mailer->Username = Yii::app()->params['adminEmail'];
self::$_mailer->Password = Yii::app()->params['mailPassword'];
self::$_mailer->WordWrap = 70;
return true;
}
示例6: initPHPMailer
/**
* Initializes the PHPMailer.
* @return true|false
*/
private function initPHPMailer()
{
$this->_mailer = new PHPMailer();
$this->_mailer->IsSMTP();
$this->_mailer->Host = 'mail.lintinzone.com';
$this->_mailer->SMTPAuth = true;
$this->_mailer->Username = 'info@lintinzone.com';
$this->_mailer->Password = 'l1nTInte@m';
$this->_mailer->From = 'info@lintinzone.com';
$this->_mailer->FromName = 'LintinZone';
$this->_mailer->WordWrap = 70;
return false;
}
示例7: __construct
/**
* Short description of method __construct
*
* @access public
* @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
* @return mixed
*/
public function __construct()
{
$this->mailer = new PHPMailer();
if (defined('SMTP_HOST')) {
$this->mailer->IsSMTP();
$this->mailer->SMTPKeepAlive = true;
$this->mailer->SMTPDebug = DEBUG_MODE;
$this->mailer->SMTPAuth = SMTP_AUTH;
$this->mailer->Host = SMTP_HOST;
$this->mailer->Port = SMTP_PORT;
$this->mailer->Username = SMTP_USER;
$this->mailer->Password = SMTP_PASS;
}
}
示例8: PHPMailer
function send_emailMailer($recipient, $sender, $name, $subject, $message)
{
//require_once("PHPMailer/class.phpmailer.php");
include "PHPMailer/class.phpmailer.php";
include "PHPMailer/class.smtp.php";
$CI =& get_instance();
$mail = new PHPMailer();
$mail->IsSMTP();
// telling the class to use SMTP
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->Host = $CI->config->item('smtp_host');
// sets the SMTP server
$mail->Port = 25;
// set the SMTP port for the GMAIL server
$mail->Username = $CI->config->item('smtp_username');
// SMTP account username
$mail->Password = $CI->config->item('smtp_password');
// SMTP account password
$mail->SetFrom($sender, $name);
$mail->AddReplyTo($sender, $name);
$mail->Subject = $subject;
$mail->AltBody = "Reset email";
// optional, comment out and test
$mail->MsgHTML($message);
$mail->AddAddress($recipient, '');
if (!$mail->Send()) {
return array("error" => "Mailer Error: " . $mail->ErrorInfo);
} else {
return true;
}
}
示例9: PHPMailer
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;
}
示例10: Send_Mail
function Send_Mail($to, $subject, $body)
{
require 'class.phpmailer.php';
$from = "from@gmail.com";
$mail = new PHPMailer();
$mail->IsSMTP(true);
// use SMTP
$mail->IsHTML(true);
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->Host = "tls://smtp.gmail.com";
// Amazon SES server, note "tls://" protocol
$mail->Port = 465;
// set the SMTP port
$mail->Username = "sassyladies.csse@gmail.com";
// SMTP username
$mail->Password = "sassyladies";
// SMTP password
$mail->SetFrom($from, 'Find Your Perfect Roommate');
$mail->AddReplyTo($from, 'Reply to Find Your Perfect Roommate');
$mail->Subject = $subject;
$mail->MsgHTML($body);
$address = $to;
$mail->AddAddress($address, $to);
$mail->Send();
}
示例11: execute
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énero : " . $sexo . "<br/>";
$html .= "Nacionalidad: " . $employee->getNationality() . "<br/>";
$html .= "Mó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());
}
}
示例12: Send_Mail
function Send_Mail($to, $subject, $body)
{
require 'class.phpmailer.php';
$from = "HariRamaKrishna_Gurram@uml.edu";
$mail = new PHPMailer();
$mail->IsSMTP(true);
// use SMTP
$mail->IsHTML(true);
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->Host = "smtp.mandrillapp.com";
// Mandrillapp.com SES server, note "tls://" protocol
$mail->Port = 587;
// set the SMTP port
$mail->Username = "g.hariramakrishna@yahoo.com";
// SMTP username
$mail->Password = "IoO9J1uH1MvKHp9wjEsJdQ";
// SMTP password
$mail->SetFrom($from, 'ISA Website');
$mail->AddReplyTo($from, 'ISA Website');
$mail->Subject = $subject;
$mail->MsgHTML($body);
$address = $to;
$mail->AddAddress($address, $to);
$mail->Send();
}
示例13: getMailer
/**
* 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;
}
示例14: WSTSendMail
/**
* 邮件发送函数
* @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;
}
}
示例15: smtpmailer
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;
}
}