本文整理汇总了PHP中PHPMailer::ClearAllRecipients方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::ClearAllRecipients方法的具体用法?PHP PHPMailer::ClearAllRecipients怎么用?PHP PHPMailer::ClearAllRecipients使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::ClearAllRecipients方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
function send($address_to, $subject, $htmlcontent, $plaincontent, $attachment)
{
global $admin_name, $admin_email;
$PHPMailer = new PHPMailer();
$PHPMailer->From = $admin_email;
$PHPMailer->FromName = $admin_name;
$PHPMailer->ClearAllRecipients();
$PHPMailer->AddAddress($address_to);
$PHPMailer->Subject = $subject;
$PHPMailer->Body = $htmlcontent;
$PHPMailer->AltBody = $plaincontent;
$PHPMailer->IsHTML(true);
while (list($k, $v) = each($attachment)) {
$PHPMailer->AddAttachment($v['file'], $v['nickname']);
}
$status = @$PHPMailer->Send();
$PHPMailer->ClearAddresses();
$PHPMailer->ClearAttachments();
return $status;
}
示例2: Clear
/**
* Clears out all previously specified values for this object and restores
* it to the state it was in when it was instantiated.
*
* @return Email
*/
public function Clear()
{
$this->PhpMailer->ClearAllRecipients();
$this->PhpMailer->Body = '';
$this->From();
$this->_IsToSet = FALSE;
$this->MimeType(Gdn::Config('Garden.Email.MimeType', 'text/plain'));
$this->_MasterView = 'email.master';
return $this;
}
示例3: sendemail
function sendemail($toname, $toemail, $fromname, $fromemail, $subject, $message, $type = "plain", $cc = "", $bcc = "")
{
global $settings, $locale;
require_once INCLUDES . "class.phpmailer.php";
$mail = new PHPMailer();
if (file_exists(INCLUDES . "language/phpmailer.lang-" . $locale['phpmailer'] . ".php")) {
$mail->SetLanguage($locale['phpmailer'], INCLUDES . "language/");
} else {
$mail->SetLanguage("en", INCLUDES . "language/");
}
if (!$settings['smtp_host']) {
$mail->IsMAIL();
} else {
$mail->IsSMTP();
$mail->Host = $settings['smtp_host'];
$mail->Port = $settings['smtp_port'];
$mail->SMTPAuth = $settings['smtp_auth'] ? true : false;
$mail->Username = $settings['smtp_username'];
$mail->Password = $settings['smtp_password'];
}
$mail->CharSet = $locale['charset'];
$mail->From = $fromemail;
$mail->FromName = $fromname;
$mail->AddAddress($toemail, $toname);
$mail->AddReplyTo($fromemail, $fromname);
if ($cc) {
$cc = explode(", ", $cc);
foreach ($cc as $ccaddress) {
$mail->AddCC($ccaddress);
}
}
if ($bcc) {
$bcc = explode(", ", $bcc);
foreach ($bcc as $bccaddress) {
$mail->AddBCC($bccaddress);
}
}
if ($type == "plain") {
$mail->IsHTML(false);
} else {
$mail->IsHTML(true);
}
$mail->Subject = $subject;
$mail->Body = $message;
if (!$mail->Send()) {
$mail->ErrorInfo;
$mail->ClearAllRecipients();
$mail->ClearReplyTos();
return false;
} else {
$mail->ClearAllRecipients();
$mail->ClearReplyTos();
return true;
}
}
示例4: send
/**
* Short description of method send
*
* @access public
* @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
* @return int
*/
public function send()
{
$returnValue = (int) 0;
foreach ($this->messages as $message) {
if ($message instanceof tao_helpers_transfert_Message) {
$this->mailer->SetFrom($message->getFrom());
$this->mailer->AddReplyTo($message->getFrom());
$this->mailer->Subject = $message->getTitle();
$this->mailer->AltBody = strip_tags(preg_replace("/<br.*>/i", "\n", $message->getBody()));
$this->mailer->MsgHTML($message->getBody());
$this->mailer->AddAddress($message->getTo());
try {
if ($this->mailer->Send()) {
$message->setStatus(tao_helpers_transfert_Message::STATUS_SENT);
$returnValue++;
}
if ($this->mailer->IsError()) {
if (DEBUG_MODE) {
echo $this->mailer->ErrorInfo . "<br>";
}
$message->setStatus(tao_helpers_transfert_Message::STATUS_ERROR);
}
} catch (phpmailerException $pe) {
if (DEBUG_MODE) {
print $pe;
}
}
}
$this->mailer->ClearReplyTos();
$this->mailer->ClearAllRecipients();
}
$this->mailer->SmtpClose();
return (int) $returnValue;
}
示例5: enviar
public function enviar($para = array())
{
if (count($para) == 0) {
$para = $this->para;
}
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "a2plcpnl0171.prod.iad2.secureserver.net";
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
$mail->Port = 465;
$mail->Username = 'contato@zappragas.com.br';
$mail->Password = 'contatozap';
$mail->From = $this->de;
$mail->Sender = $this->de;
$mail->FromName = $this->nome;
foreach ($para as $p) {
$mail->AddAddress($p);
}
$mail->IsHTML(true);
$mail->Subject = $this->assunto;
$mail->Body = $this->conteudo;
@$mail->Send();
$mail->ClearAllRecipients();
$mail->ClearAttachments();
}
示例6: initMailFromSet
/**
* Inner mailer initialization from set variables
*
* @return void
*/
protected function initMailFromSet()
{
$this->mail->SetLanguage($this->get('langLocale'), $this->get('langPath'));
$this->mail->CharSet = $this->get('charset');
$this->mail->From = $this->get('from');
$this->mail->FromName = $this->get('from');
$this->mail->Sender = $this->get('from');
$this->mail->ClearAllRecipients();
$this->mail->ClearAttachments();
$this->mail->ClearCustomHeaders();
$emails = explode(static::MAIL_SEPARATOR, $this->get('to'));
foreach ($emails as $email) {
$this->mail->AddAddress($email);
}
$this->mail->Subject = $this->get('subject');
$this->mail->AltBody = $this->createAltBody($this->get('body'));
$this->mail->Body = $this->get('body');
// add custom headers
foreach ($this->get('customHeaders') as $header) {
$this->mail->AddCustomHeader($header);
}
if (is_array($this->get('images'))) {
foreach ($this->get('images') as $image) {
// Append to $attachment array
$this->mail->AddEmbeddedImage($image['path'], $image['name'] . '@mail.lc', $image['name'], 'base64', $image['mime']);
}
}
}
示例7:
/**
* Test BCC-only addressing
*/
function test_BCCAddressing()
{
$this->Mail->Subject .= ': BCC-only addressing';
$this->BuildBody();
$this->Mail->ClearAllRecipients();
$this->assertTrue($this->Mail->AddBCC('a@example.com'), 'BCC addressing failed');
$this->assertTrue($this->Mail->Send(), 'Send failed');
}
示例8: Send
public function Send(IEmailMessage $emailMessage)
{
$this->phpMailer->ClearAllRecipients();
$this->phpMailer->ClearReplyTos();
$this->phpMailer->CharSet = $emailMessage->Charset();
$this->phpMailer->Subject = $emailMessage->Subject();
$this->phpMailer->Body = $emailMessage->Body();
$from = $emailMessage->From();
$defaultFrom = Configuration::Instance()->GetSectionKey(ConfigSection::EMAIL, ConfigKeys::DEFAULT_FROM_ADDRESS);
$defaultName = Configuration::Instance()->GetSectionKey(ConfigSection::EMAIL, ConfigKeys::DEFAULT_FROM_NAME);
$address = empty($defaultFrom) ? $from->Address() : $defaultFrom;
$name = empty($defaultName) ? $from->Name() : $defaultName;
$this->phpMailer->SetFrom($address, $name);
$replyTo = $emailMessage->ReplyTo();
$this->phpMailer->AddReplyTo($replyTo->Address(), $replyTo->Name());
$to = $this->ensureArray($emailMessage->To());
$toAddresses = new StringBuilder();
foreach ($to as $address) {
$toAddresses->Append($address->Address());
$this->phpMailer->AddAddress($address->Address(), $address->Name());
}
$cc = $this->ensureArray($emailMessage->CC());
foreach ($cc as $address) {
$this->phpMailer->AddCC($address->Address(), $address->Name());
}
$bcc = $this->ensureArray($emailMessage->BCC());
foreach ($bcc as $address) {
$this->phpMailer->AddBCC($address->Address(), $address->Name());
}
if ($emailMessage->HasStringAttachment()) {
Log::Debug('Adding email attachment %s', $emailMessage->AttachmentFileName());
$this->phpMailer->AddStringAttachment($emailMessage->AttachmentContents(), $emailMessage->AttachmentFileName());
}
Log::Debug('Sending %s email to: %s from: %s', get_class($emailMessage), $toAddresses->ToString(), $from->Address());
$success = false;
try {
$success = $this->phpMailer->Send();
} catch (Exception $ex) {
Log::Error('Failed sending email. Exception: %s', $ex);
}
Log::Debug('Email send success: %d. %s', $success, $this->phpMailer->ErrorInfo);
}
示例9: index
public function index()
{
$this->toView['title'] = 'Email teste';
$this->loadLib('phpmailer');
$mail = new PHPMailer();
//Define os dados do servidor e tipo de conexão
$mail->IsSMTP();
// Define que a mensagem será SMTP
$mail->Host = "webmail.grupomaggi.com.br";
// Endereço do servidor SMTP
$mail->Port = 25;
$mail->SMTPAuth = true;
// Autenticação
$mail->Username = 'maggi\\hudson.ventura';
// Usuário do servidor SMTP
$mail->Password = 'maggi@2027';
// Senha da caixa postal utilizada
//Define o remetente
$mail->From = "helpdesk@amaggi.com.br";
$mail->FromName = "Alteração no estado de um link";
//Define os destinatário(s)
$mail->AddAddress('hudson.ventura@amaggi.com.br', 'Nome do Destinatário');
//$mail->AddAddress('e-mail@destino2.com.br');
//$mail->AddCC('copia@dominio.com.br', 'Copia');
//$mail->AddBCC('CopiaOculta@dominio.com.br', 'Copia Oculta');
//Define os dados técnicos da Mensagem
$mail->IsHTML(true);
// Define que o e-mail será enviado como HTML
$mail->CharSet = 'UTF-8';
// Charset da mensagem (opcional)
//Texto e Assunto
$mail->Subject = "Mensagem Teste";
// Assunto da mensagem
$mail->Body = 'Este é o corpo da mensagem de teste, em HTML!
<IMG src="http://seudominio.com.br/imagem.jpg" alt=5":)" class="wp-smiley"> ';
$mail->AltBody = 'Este é o corpo da mensagem de teste, em Texto Plano! \\r\\n
<IMG src="http://seudominio.com.br/imagem.jpg" alt=5":)" class="wp-smiley"> ';
//Anexos (opcional)
//$mail->AddAttachment("e:\home\login\web\documento.pdf", "novo_nome.pdf");
//Envio da Mensagem
$enviado = $mail->Send();
//Limpa os destinatários e os anexos
$mail->ClearAllRecipients();
$mail->ClearAttachments();
//Exibe uma mensagem de resultado
if ($enviado) {
echo "E-mail enviado com sucesso!";
} else {
echo "Não foi possível enviar o e-mail.\n\t\t \n\t\t";
echo "Informações do erro: \n\t\t" . $mail->ErrorInfo;
}
//$this->loadView('viewDashboard');
}
示例10:
/**
* Test error handling
*/
function test_Error()
{
$this->Mail->Subject .= ": This should be sent";
$this->BuildBody();
$this->Mail->ClearAllRecipients();
// no addresses should cause an error
$this->assertTrue($this->Mail->IsError() == false, "Error found");
$this->assertTrue($this->Mail->Send() == false, "Send succeeded");
$this->assertTrue($this->Mail->IsError(), "No error found");
$this->assertEquals('You must provide at least one recipient email address.', $this->Mail->ErrorInfo);
$this->Mail->AddAddress($_REQUEST['mail_to']);
$this->assertTrue($this->Mail->Send(), "Send failed");
}
示例11: enviar
public function enviar($para, $assunto, $html, $variaveis = "")
{
if ($_SERVER['SERVER_NAME'] == 'localhost') {
return true;
} else {
require_once "PHPMailer/class.phpmailer.php";
$mail = new PHPMailer();
//$mail->IsSMTP(); // Define que a mensagem será SMTP
//$mail->Host = "smtp.dominio.net"; // Endereço do servidor SMTP
//$mail->SMTPAuth = true; // Usa autenticação SMTP? (opcional)
//$mail->Username = 'seumail@dominio.net'; // Usuário do servidor SMTP
//$mail->Password = 'senha'; // Senha do servidor SMTP
// Define o remetente
$mail->From = "contato@ipanemaeventos.com.br";
// Seu e-mail
$mail->FromName = "Ipanema Eventos";
// Seu nome
// Define os destinatário(s)
$mail->AddAddress($para);
//$mail->AddAddress('ciclano@site.net');
//$mail->AddCC('ciclano@site.net', 'Ciclano'); // Copia
//$mail->AddBCC('fulano@dominio.com.br', 'Fulano da Silva'); // Cópia Oculta
$mail->IsHTML(true);
$mail->Subject = $assunto;
$mail->CharSet = 'UTF-8';
if (file_exists(PATHEMAIL . $html)) {
$corpo = file_get_contents(PATHEMAIL . $html);
// substitui variaveis
if (is_array($variaveis)) {
foreach ($variaveis as $nomeVar => $valorVar) {
$corpo = str_replace("\${$nomeVar}", $valorVar, $corpo);
}
}
} else {
return false;
}
$mail->Body = $corpo;
// Envia o e-mail
$enviado = $mail->Send();
// Limpa os destinatários e os anexos
$mail->ClearAllRecipients();
$mail->ClearAttachments();
// Exibe uma mensagem de resultado
if ($enviado) {
return true;
} else {
//$mail->ErrorInfo;
return false;
}
}
}
示例12: send
public function send($report)
{
//если отправлять некуда или незачем, то делаем вид, что отправили
if (!$this->getCFGDef('to') || $this->getCFGDef('noemail')) {
return true;
} elseif (empty($report)) {
return false;
}
$this->mail->IsHTML($this->getCFGDef('isHtml', 1));
$this->mail->From = $this->getCFGDef('from', $this->modx->config['site_name']);
$this->mail->FromName = $this->getCFGDef('fromName', $this->modx->config['emailsender']);
$this->mail->Subject = $this->getCFGDef('subject');
$this->mail->Body = $report;
$this->addAddressToMailer("replyTo", $this->getCFGDef('replyTo'));
$this->addAddressToMailer("to", $this->getCFGDef('to'));
$this->addAddressToMailer("cc", $this->getCFGDef('cc'));
$this->addAddressToMailer("bcc", $this->getCFGDef('bcc'));
$result = $this->mail->send();
if ($result) {
$this->mail->ClearAllRecipients();
$this->mail->ClearAttachments();
}
return $result;
}
示例13: sendMail
function sendMail($toMail, $toName, $subject, $textContent, $fromMail, $fromName, $html = 1, $mailcc = '')
{
//require_once "class.phpmailer.php";
//require_once "class.smtp.php";
require_once "class.phpmailer.php";
require_once "class.smtp.php";
$sendMail = $toMail;
$sendName = $toName;
$mailSubject = $subject;
$mail = new PHPMailer();
$mail->Subject = $mailSubject;
$mail->From = $fromMail;
$mail->FromName = $fromName;
$mail->Body = $textContent;
if ($mailcc != '') {
$mail->AddCC($mailcc);
}
if ($html == 1) {
$mail->isHTML(true);
}
if (preg_match("/,/i", $sendMail)) {
$arr = explode(",", $sendMail);
} else {
$arr[0] = $sendMail;
}
foreach ($arr as $val) {
if (preg_match("/@/i", $val)) {
$name = $val;
$mail->AddAddress($val, $sendName);
//$mail->AddBCC("debopam.majilya@gmail.com", "Debopam");
$mail->AddReplyTo($fromMail, $fromName);
if (!$mail->Send()) {
$flag = 0;
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
} else {
$flag = 1;
}
$mail->ClearAllRecipients();
}
}
if ($flag == 1) {
return true;
} else {
return false;
}
}
示例14:
/**
* Test error handling
*/
function test_Error()
{
$this->Mail->Subject .= ": This should be sent";
$this->BuildBody();
$this->Mail->ClearAllRecipients(); // no addresses should cause an error
$this->assertTrue($this->Mail->IsError() == false, "Error found");
$this->assertTrue($this->Mail->Send() == false, "Send succeeded");
$this->assertTrue($this->Mail->IsError(), "No error found");
$this->assertEquals('You must provide at least one recipient email address.', $this->Mail->ErrorInfo);
if(!isset($_REQUEST['mail_to'])){
$this->markTestSkipped('Skipping re-send after removing addresses, no address requested.');
return;
}
$this->Mail->AddAddress($_REQUEST['mail_to']);
$this->assertTrue($this->Mail->Send(), "Send failed");
}
示例15: envia
function envia($from, $fromName, $to, $sub, $message, $anexo = false, $anexos = '')
{
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->Debugoutput = 'html';
/** Acessos para envio do email **/
$mail->Host = SMTP;
$mail->Port = PORTA;
$mail->SMTPAuth = true;
$mail->Username = USER_EMAIL;
//'vinicius@bnsites.com.br';
$mail->Password = PASS_EMAIL;
//barbarulo.vini
/** Detalhes do email **/
$mail->CharSet = 'UTF-8';
$mail->setFrom($from, $fromName);
$mail->addReplyTo($from, $fromName);
$mail->addAddress($to);
$mail->Subject = $sub;
$mail->msgHTML($message);
$mail->AltBody = $message;
#$mail->addBcc = $message;
/** Verifica a existencia de anexos **/
if ($anexo === true) {
//$caminho_anexo = '';
//copy($anexos['tmp_name'], $caminho_anexo.$anexos['name']);
//$mail->AddAttachment($caminho_anexo.$anexos['name']) or die('Erro ao anexar '.$anexos['name']);
$mail->AddAttachment($anexos);
}
/** Envia a mensagem **/
if (!$mail->send()) {
return $mail->ErrorInfo;
} else {
$mail->ClearAllRecipients();
$mail->ClearAttachments();
/** Limpa os anexos caso exista **/
// if($anexo === true){
// unlink($caminho_anexo.$anexos['name']);
// }
return true;
}
}