本文整理汇总了PHP中PHPMailer::addReplyTo方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::addReplyTo方法的具体用法?PHP PHPMailer::addReplyTo怎么用?PHP PHPMailer::addReplyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::addReplyTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDuplicateIDNRemoved
/**
* Tests removal of duplicate recipients and reply-tos.
*/
public function testDuplicateIDNRemoved()
{
if (!$this->Mail->idnSupported()) {
$this->markTestSkipped('intl and/or mbstring extensions are not available');
}
$this->Mail->clearAllRecipients();
$this->Mail->clearReplyTos();
$this->Mail->CharSet = 'utf-8';
$this->assertTrue($this->Mail->addAddress('test@françois.ch'));
$this->assertFalse($this->Mail->addAddress('test@françois.ch'));
$this->assertTrue($this->Mail->addAddress('test@FRANÇOIS.CH'));
$this->assertFalse($this->Mail->addAddress('test@FRANÇOIS.CH'));
$this->assertTrue($this->Mail->addAddress('test@xn--franois-xxa.ch'));
$this->assertFalse($this->Mail->addAddress('test@xn--franois-xxa.ch'));
$this->assertFalse($this->Mail->addAddress('test@XN--FRANOIS-XXA.CH'));
$this->assertTrue($this->Mail->addReplyTo('test+replyto@françois.ch'));
$this->assertFalse($this->Mail->addReplyTo('test+replyto@françois.ch'));
$this->assertTrue($this->Mail->addReplyTo('test+replyto@FRANÇOIS.CH'));
$this->assertFalse($this->Mail->addReplyTo('test+replyto@FRANÇOIS.CH'));
$this->assertTrue($this->Mail->addReplyTo('test+replyto@xn--franois-xxa.ch'));
$this->assertFalse($this->Mail->addReplyTo('test+replyto@xn--franois-xxa.ch'));
$this->assertFalse($this->Mail->addReplyTo('test+replyto@XN--FRANOIS-XXA.CH'));
$this->buildBody();
$this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
// There should be only one "To" address and one "Reply-To" address.
$this->assertEquals(1, count($this->Mail->getToAddresses()), 'Bad count of "to" recipients');
$this->assertEquals(1, count($this->Mail->getReplyToAddresses()), 'Bad count of "reply-to" addresses');
}
示例2: 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;
}
}
示例3: _setupMailer
private function _setupMailer()
{
$this->_mailer = new PHPMailer();
//$this->_mailer->SMTPDebug = 3; // Enable verbose debug output
$this->_mailer->isSMTP();
// Set mailer to use SMTP
$this->_mailer->Host = 'mx1.hostinger.ro';
// Specify main and backup SMTP servers
$this->_mailer->SMTPAuth = true;
// Enable SMTP authentication
$this->_mailer->Username = 'auto@azz.hol.es';
// SMTP username
$this->_mailer->Password = 'str82nr1';
// SMTP password
$this->_mailer->SMTPSecure = 'tls';
// Enable TLS encryption, `ssl` also accepted
$this->_mailer->Port = 587;
// TCP port to connect to
$this->_mailer->isHTML(true);
// Set email format to HTML
$this->_mailer->From = 'auto@azz.hol.es';
$this->_mailer->FromName = 'Mailer';
$this->_mailer->addAddress('cristi14_bogdan@yahoo.com', 'Cristi');
// Add a recipient
$this->_mailer->addReplyTo('auto@azz.hol.es', 'Auto Mailer');
}
示例4: SendMail
public static function SendMail($from, $to, $subject, $content, $isHTML = false)
{
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = 'relay.proximus.be';
if (is_array($from)) {
$mail->From = array_values(array_shift(array_values($from)));
$mail->FromName = array_values(array_shift(array_keys($from)));
} else {
$mail->From = $from;
$mail->FromName = $from;
}
foreach ($to as $key => $value) {
$mail->addAddress($value, $key);
// Add a recipient
}
if (is_array($from)) {
$mail->addReplyTo(array_values(array_shift(array_keys($from))), array_values(array_shift(array_values($from))));
} else {
$mail->addReplyTo($from, $from);
}
$mail->isHTML($isHTML);
$mail->Subject = $subject;
$mail->Body = $content;
return $mail->send();
}
示例5: _setupMailer
private function _setupMailer()
{
$this->_mailer = new PHPMailer(true);
$this->_mailer->SMTPDebug = self::DEBUG_LEVEL;
// Enable verbose debug output
$this->_mailer->isSMTP();
// Set mailer to use SMTP
$this->_mailer->Host = SMTP_HOST;
// Specify main and backup SMTP servers
$this->_mailer->SMTPAuth = true;
// Enable SMTP authentication
$this->_mailer->Username = SMTP_USER;
// SMTP username
$this->_mailer->Password = SMTP_PASS;
// SMTP password
$this->_mailer->SMTPSecure = SMTP_ENCRYPT;
// Enable TLS encryption, `ssl` also accepted
$this->_mailer->Port = SMTP_PORT;
// TCP port to connect to
$this->_mailer->isHTML(true);
// Set email format to HTML
$this->_mailer->From = SMTP_USER;
$this->_mailer->FromName = SMTP_NAME;
$this->_mailer->addAddress(self::RECIPIENT_ADDRESS, self::RECIPIENT_NAME);
// Add a recipient
$this->_mailer->addReplyTo('auto@azz.hol.es', SMTP_NAME);
}
示例6: send
private function send()
{
$mail = new PHPMailer();
if (!empty($this->config->mailer)) {
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP();
// Set mailer to use SMTP
$mail->Host = $this->config->mailer->Host;
// Specify main and backup SMTP servers
$mail->SMTPAuth = $this->config->mailer->SMTPAuth;
// Enable SMTP authentication
$mail->Username = $this->config->mailer->Username;
// SMTP username
$mail->Password = $this->config->mailer->Password;
// SMTP password
if (isset($this->config->mailer->SMTPSecure)) {
$mail->SMTPSecure = $this->config->mailer->SMTPSecure;
// Enable TLS encryption, `ssl` also accepted
}
$mail->Port = $this->config->mailer->Port;
// TCP port to connect to
$mail->From = $this->config->mailer->From;
$mail->FromName = $this->config->mailer->FromName;
} else {
$mail->From = $this->from;
$mail->FromName = $this->config->site->titulo;
$mail->isMail();
}
if (!empty($this->replyTo)) {
$mail->addReplyTo($this->replyTo);
}
$mail->addAddress($this->to);
// Add a recipient
$mail->addReplyTo($this->to);
$mail->CharSet = 'UTF-8';
$mail->isHTML(true);
// Set email format to HTML
$mail->Subject = $this->subject;
$mail->Body = $this->message;
if (!$mail->send()) {
if (true == $this->config->debug) {
die('Mailer Error: ' . $mail->ErrorInfo);
}
return false;
} else {
return true;
}
}
示例7: sendmail
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 = "bookmyprinterncku@gmail.com";
$mail->Password = "e8k9j9e1rz58";
$mail->setFrom('bookmyprinterncku@gmail.com', 'book printer');
$mail->addReplyTo('bookmyprinterncku@gmail.com', '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;
}
}
示例8: onLoad
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('from@vp.d2.pl', 'First Last');
$mail->addReplyTo('from@vp.d2.pl');
$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;
}
示例9: sendmail
function sendmail($from, $fromname, $to, $subject, $body)
{
//SMTP Mail start
$mail = new PHPMailer();
//$mail->IsSendmail();
$mail->IsSMTP();
// telling the class to use SMTP
$mail->Mailer = "smtp";
$mail->Host = "localhost";
$mail->Port = 25;
$mail->IsHTML(true);
$mail->From = 'dummy';
$mail->FromName = 'dummy';
$mail->addAddress($to, $to);
// Add a recipient
if ($from != '' && $fromname != '') {
$mail->addReplyTo($from, $fromname);
}
$mail->Subject = $subject;
$mail->Body = $body;
if (!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
//SMTP Mail End
}
示例10: EnviarCorreo
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;
}
示例11: testAddressing
/**
* 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('a@example..com'), 'Invalid address accepted');
$this->assertTrue($this->Mail->addAddress('a@example.com'), 'Addressing failed');
$this->assertFalse($this->Mail->addAddress('a@example.com'), 'Duplicate addressing failed');
$this->assertTrue($this->Mail->addCC('b@example.com'), 'CC addressing failed');
$this->assertFalse($this->Mail->addCC('b@example.com'), 'CC duplicate addressing failed');
$this->assertFalse($this->Mail->addCC('a@example.com'), 'CC duplicate addressing failed (2)');
$this->assertTrue($this->Mail->addBCC('c@example.com'), 'BCC addressing failed');
$this->assertFalse($this->Mail->addBCC('c@example.com'), 'BCC duplicate addressing failed');
$this->assertFalse($this->Mail->addBCC('a@example.com'), 'BCC duplicate addressing failed (2)');
$this->assertTrue($this->Mail->addReplyTo('a@example.com'), 'Replyto Addressing failed');
$this->assertFalse($this->Mail->addReplyTo('a@example..com'), 'Invalid Replyto address accepted');
$this->assertTrue($this->Mail->setFrom('a@example.com', 'some name'), 'setFrom failed');
$this->assertFalse($this->Mail->setFrom('a@example.com.', 'some name'), 'setFrom accepted invalid address');
$this->Mail->Sender = '';
$this->Mail->setFrom('a@example.com', 'some name', true);
$this->assertEquals($this->Mail->Sender, 'a@example.com', 'setFrom failed to set sender');
$this->Mail->Sender = '';
$this->Mail->setFrom('a@example.com', 'some name', false);
$this->assertEquals($this->Mail->Sender, '', 'setFrom should not have set sender');
$this->Mail->clearCCs();
$this->Mail->clearBCCs();
$this->Mail->clearReplyTos();
}
示例12: send
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();
}
示例13: send
/**
* Функция отправки сообщения:
*
* @param string $from - адрес отправителя
* @param string|array $to - адрес(-а) получателя
* @param string $theme - тема письма
* @param string $body - тело письма
* @param bool $isText - является ли тело письма текстом
* @param array $replyTo добавляет заголовок Reply-To, формат [email => имя]
*
* @return bool отправилось ли письмо
**/
public function send($from, $to, $theme, $body, $isText = false, $replyTo = [])
{
$this->_mailer->clearAllRecipients();
$this->setFrom($from);
if (is_array($to)) {
foreach ($to as $email) {
$this->addAddress($email);
}
} else {
$this->addAddress($to);
}
$this->setSubject($theme);
if ($isText) {
$this->_mailer->Body = $body;
$this->_mailer->isHTML(false);
} else {
$this->_mailer->msgHTML($body, \Yii::app()->basePath);
}
if (!empty($replyTo)) {
$this->_mailer->clearReplyTos();
foreach ($replyTo as $email => $name) {
$this->_mailer->addReplyTo($email, $name);
}
}
try {
return $this->_mailer->send();
} catch (\Exception $e) {
\Yii::log($e->__toString(), \CLogger::LEVEL_ERROR, 'mail');
return false;
}
}
示例14: sendEmail
static function sendEmail($recipient, $from, $subject, $message, $smtp = true)
{
$emailConfig = (require SOURCES_PATH . '/email.php');
//die($message);
$mail = new \PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true));
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->SMTPSecure = $emailConfig['smtp']["secure"];
// sets the prefix to the servier
$mail->Host = $emailConfig['smtp']["host"];
// sets GMAIL as the SMTP server
$mail->Port = $emailConfig['smtp']["port"];
// set the SMTP port for the GMAIL server
$mail->Username = $emailConfig['smtp']["username"];
$mail->Password = $emailConfig['smtp']["password"];
$mail->From = $from;
$mail->FromName = "No-reply: Event Registration";
$mail->addReplyTo($from, "Event Registration");
// Recipient email
$html = $message;
// Replace contents
$mail->addAddress($recipient);
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
// End of recipient email
if ($mail->send()) {
return true;
exit;
}
return false;
}
示例15: sendmail
public function sendmail()
{
//trebalo bi ovako nesto da ide ja sam otvorio ovaj mail nalog i dodelio mu ovaj password
$mail = new PHPMailer();
$mail->isSMTP();
// Set mailer to use SMTP
$mail->Host = 'smtp.mandrillapp.com';
// Specify main and backup SMTP servers
$mail->SMTPAuth = true;
// Enable SMTP authentication
$mail->Username = 'admin@creativeeweb.com';
// SMTP username
$mail->Password = 'VmQi5yPJNC-7TPhCUry8Lw';
// SMTP password
$mail->SMTPSecure = 'tls';
// Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;
// TCP port to connect to
$mail->From = $this->from_email;
$mail->FromName = 'Agencija SHOPKO';
$mail->addAddress($this->to_email);
// Add a recipient
$mail->addReplyTo('office@shopko.rs');
$mail->isHTML(true);
$mail->Subject = $this->subject_str;
$mail->Body = $this->setup_message();
if (null !== $this->attachment) {
foreach ($this->attachment as $a) {
$mail->addAttachment($a);
}
}
//slanje
$mail->send();
//mail($this->to_email, $this->subject_str, $this->setup_message(), $this->setup_headers());
}