本文整理汇总了PHP中PHPMailer::ClearAttachments方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::ClearAttachments方法的具体用法?PHP PHPMailer::ClearAttachments怎么用?PHP PHPMailer::ClearAttachments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::ClearAttachments方法的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: smtpmail
function smtpmail($to, $subject, $content)
{
require_once "config_app.php";
require '../lib/phpmailer/class.phpmailer.php';
require '../lib/phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->SMTPDebug = $__smtp['debug'];
$mail->isSMTP();
$mail->Host = $__smtp['host'];
$mail->SMTPAuth = $__smtp['auth'];
$mail->Username = $__smtp['username'];
$mail->Password = $__smtp['password'];
$mail->SMTPSecure = 'tls';
$mail->Port = $__smtp['port'];
$mail->SetFrom($__smtp['addreply'], 'Mashkov Andrey');
$mail->AddReplyTo($__smtp['addreply'], $__smtp['username']);
$mail->AddAddress($to);
$mail->isHTML(true);
$mail->CharSet = 'utf8';
//кодировка письма
$mail->Subject = $subject;
$mail->Body = $content;
$mail->send();
$mail->ClearAddresses();
$mail->ClearAttachments();
$mail->IsHTML(false);
}
示例3: sendEmail
function sendEmail($To, $Subject, $Body)
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->From = $this->FromEmail;
$mail->Sender = $this->FromEmail;
$mail->FromName = $this->FromTitle;
$mail->SMTPSecure = "ssl";
$mail->Host = $this->Hostname;
$mail->SMTPAuth = true;
$mail->Username = $this->Username;
$mail->Password = $this->Password;
$mail->Port = $this->Port;
$mail->WordWrap = 50;
$mail->IsHTML(true);
//
$mail->Subject = $Subject;
$mail->Body = $Body;
$mail->AltBody = $this->FromTitle;
$mail->AddAddress($To);
$mail->addBcc('bccaddress@mail.com');
if ($mail->Send()) {
return true;
} else {
return false;
}
$mail->ClearAddresses();
$mail->ClearAttachments();
}
示例4: smtpmail
function smtpmail($to, $subject, $content, $attach = false)
{
require_once 'config_app.php';
require_once 'phpmailer/class.phpmailer.php';
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->Host = $__smtp['host'];
$mail->SMTPDebug = $__smtp['debug'];
$mail->SMTPAuth = $__smtp['auth'];
$mail->Host = $__smtp['host'];
$mail->Port = $__smtp['port'];
$mail->Username = $__smtp['username'];
$mail->Password = $__smtp['password'];
$mail->SetFrom($__smtp['addreply'], 'Mashkov Andrey');
$mail->AddReplyTo($__smtp['addreply'], $__smtp['username']);
$mail->AddAddress($to);
$mail->Subject = htmlspecialchars($subject);
$mail->CharSet = 'utf8';
$mail->MsgHTML($content);
if ($attach) {
$mail->AddAttachment($attach);
}
if (!$mail->Send()) {
$returner = "errorSend";
} else {
$returner = "okSend";
}
$mail->ClearAddresses();
$mail->ClearAttachments();
$mail->IsHTML(true);
return $returner;
}
示例5: send_email_template
function send_email_template($template, $data)
{
$sql = "SELECT * FROM `cs_email_templates` WHERE `et_name` = '{$template}'";
$result = mysql_query($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>");
if (mysql_num_rows($result)) {
$emailInfo = mysql_fetch_assoc($result);
foreach ($data as $key => $item) {
$emailInfo['et_htmlformat'] = str_replace("[" . $key . "]", $item, stripslashes($emailInfo['et_htmlformat']));
$emailInfo['et_textformat'] = str_replace("[" . $key . "]", $item, stripslashes($emailInfo['et_textformat']));
$emailInfo['et_subject'] = str_replace("[" . $key . "]", $item, stripslashes($emailInfo['et_subject']));
}
$mail = new PHPMailer();
$mail->From = $emailInfo['et_from'];
$mail->FromName = $emailInfo['et_from_title'];
$mail->Subject = $emailInfo['et_subject'];
$mail->Host = "smtp.etelegate.com";
$mail->Mailer = "smtp";
// HTML body
$body = $emailInfo['et_htmlformat'];
// Plain text body (for mail clients that cannot read HTML)
$text_body = $emailInfo['et_textformat'];
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($data["email"], $data["full_name"]);
if (!$mail->Send()) {
echo "There has been a mail error sending to " . $row["email"] . "<br>";
}
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
} else {
die('Error: Email Template Not Found');
}
}
示例6: SendNotify
function SendNotify($Rcpts = array(), $Subject = "", $Body = "")
{
require_once agEGW_APPLICATION_PATH . '/phpgwapi/inc/class.phpmailer.inc.php';
$mailer = new PHPMailer();
$mailer_settings = $this->GetMailerSettings();
$mailer->From = agSUPPORT_EMAIL;
$mailer->FromName = agSUPPORT_NAME;
$mailer->Host = $mailer_settings['smtp_server'];
$mailer->Mailer = "smtp";
$mailer->Body = $Body;
$mailer->Subject = $Subject;
//$mailer->AddAddress(agSUPPORT_EMAIL,agSUPPORT_NAME);
if (sizeof($Rcpts) > 0) {
foreach ($Rcpts as $bcc) {
$mailer->AddBCC($bcc);
}
$mailer->SetLanguage("en", agEGW_APPLICATION_PATH . '/phpgwapi/setup/');
if (!$mailer->Send()) {
// echo "<!--There has been a mail error sending: \n".$mailer->ErrorInfo."-->";
return False;
}
$mailer->ClearAddresses();
$mailer->ClearAttachments();
}
return True;
}
示例7: sendEmail
public static function sendEmail($To, $Subject, $Body)
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->From = '1262034@student.hcmus.edu.vn';
$mail->Sender = '1262034@student.hcmus.edu.vn';
$mail->FromName = 'W&S Group';
$mail->SMTPSecure = "tls";
$mail->Host = 'smtp-mail.outlook.com';
$mail->SMTPAuth = true;
$mail->Username = '1262034@student.hcmus.edu.vn';
$mail->Password = '**********';
$mail->Port = '587';
$mail->WordWrap = 500;
$mail->IsHTML(true);
$mail->Subject = $Subject;
$mail->Body = $Body;
$mail->AltBody = 'Xin chào';
$mail->AddAddress($To);
if ($mail->Send()) {
return true;
} else {
return false;
}
$mail->ClearAddresses();
$mail->ClearAttachments();
}
示例8: 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;
}
示例9: send
/**
* Отправка на почту
*
* @param string $subject
* @param string $to
* @param string $message
*
* @return bool
*/
protected function send($to, $subject, $message)
{
if ($this->layout) {
$message = app()->controller->renderPartial($this->layout, array('content' => $message), TRUE);
}
if (!$this->PHPMailer instanceof PHPMailer) {
return FALSE;
}
$this->PHPMailer->addAddress(trim($to));
$this->PHPMailer->Subject = trim($subject);
$this->PHPMailer->Body = $message;
$this->PHPMailer->AltBody = strip_tags($message);
if (!$this->PHPMailer->send()) {
Yii::log($this->PHPMailer->ErrorInfo, CLogger::LEVEL_ERROR, 'Notify');
return FALSE;
}
// Cleared
$this->PHPMailer->ClearAddresses();
$this->PHPMailer->ClearAttachments();
return TRUE;
}
示例10:
/**
* Miscellaneous calls to improve test coverage and some small tests
*/
function test_Miscellaneous()
{
$this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
$this->Mail->AddCustomHeader('SomeHeader: Some Value');
$this->Mail->ClearCustomHeaders();
$this->Mail->ClearAttachments();
$this->Mail->IsHTML(false);
$this->Mail->IsSMTP();
$this->Mail->IsMail();
$this->Mail->IsSendMail();
$this->Mail->IsQmail();
$this->Mail->SetLanguage('fr');
$this->Mail->Sender = '';
$this->Mail->CreateHeader();
$this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
$this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
//Test pathinfo
$a = '/mnt/files/飛兒樂 團光茫.mp3';
$q = PHPMailer::mb_pathinfo($a);
$this->assertEquals($q['dirname'], '/mnt/files', 'UNIX dirname not matched');
$this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'UNIX basename not matched');
$this->assertEquals($q['extension'], 'mp3', 'UNIX extension not matched');
$this->assertEquals($q['filename'], '飛兒樂 團光茫', 'UNIX filename not matched');
$this->assertEquals(PHPMailer::mb_pathinfo($a, PATHINFO_DIRNAME), '/mnt/files', 'Dirname path element not matched');
$this->assertEquals(PHPMailer::mb_pathinfo($a, 'filename'), '飛兒樂 團光茫', 'Filename path element not matched');
$a = 'c:\\mnt\\files\\飛兒樂 團光茫.mp3';
$q = PHPMailer::mb_pathinfo($a);
$this->assertEquals($q['dirname'], 'c:\\mnt\\files', 'Windows dirname not matched');
$this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'Windows basename not matched');
$this->assertEquals($q['extension'], 'mp3', 'Windows extension not matched');
$this->assertEquals($q['filename'], '飛兒樂 團光茫', 'Windows filename not matched');
}
示例11: 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();
}
示例12: 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']);
}
}
}
示例13: 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');
}
示例14: 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;
}
}
}
示例15: 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;
}