本文整理汇总了PHP中PHPMailer::IsHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::IsHTML方法的具体用法?PHP PHPMailer::IsHTML怎么用?PHP PHPMailer::IsHTML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::IsHTML方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMail
function sendMail($to, $subject, $message, $fromAddress = '', $fromUserName = '', $toName = '', $bcc = '', $upload_dir = '', $filename = '')
{
try {
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "sm4.siteground.biz";
$mail->Port = 2525;
$mail->SMTPAuth = true;
$mail->SMTPDebug = 1;
// enables SMTP debug information (for testing)
// Enable SMTP authentication
$mail->Username = 'dileepkumarkonda@gmail.com';
// SMTP username
$mail->Password = 'samarasa@1234';
// SMTP password
$mail->IsHTML(true);
$mail->ClearAddresses();
$find = strpos($to, ',');
if ($find) {
$ids = explode(',', $to);
for ($i = 0; $i < count($ids); $i++) {
$mail->AddAddress($ids[$i]);
}
} else {
$mail->AddAddress($to);
}
if ($fromAddress != '') {
$mail->From = $fromAddress;
} else {
$mail->From = "dileepkumarkonda@gmail.com";
}
if ($fromUserName != '') {
$mail->FromName = $fromUserName;
} else {
$mail->FromName = "Video Collections";
}
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
if ($upload_dir != '') {
foreach ($upload_dir as $uploaddirs) {
$mail->AddAttachment($uploaddirs, $filename);
}
}
if ($mail->Send()) {
return 1;
} else {
return 0;
}
} catch (phpmailerException $e) {
echo $e->errorMessage();
//Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage();
//Boring error messages from anything else!
}
}
示例2: sendMail
function sendMail($to, $subject, $message, $fromAddress = '', $fromUserName = '', $toName = '', $bcc = '', $upload_dir = '', $filename = '')
{
$mail = new PHPMailer();
$mail->IsSMTP();
// send via SMTP
$mail->Host = "smtp.gmail.com";
// SMTP servers
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->SMTPSecure = "ssl";
// use ssl
//$mail->Host = "mail.vivateachers.org"; // GMAIL's SMTP server
$mail->Port = 465;
// SMTP port used by GMAIL server
$mail->IsHTML(true);
// [optional] send as HTML
$mail->Username = "chandra.jampana@gmail.com";
// SMTP username
$mail->Password = "CHANDRA8143155535!";
// SMTP password
$mail->ClearAddresses();
$find = strpos($to, ',');
if ($find) {
$ids = explode(',', $to);
for ($i = 0; $i < count($ids); $i++) {
$mail->AddAddress($ids[$i]);
}
} else {
$mail->AddAddress($to);
}
if ($fromAddress != '') {
$mail->From = $fromAddress;
} else {
$mail->From = "chandra.jampana@gmail.com";
}
if ($fromUserName != '') {
$mail->FromName = $fromUserName;
} else {
$mail->FromName = "MediCart";
}
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
if ($upload_dir != '') {
foreach ($upload_dir as $uploaddirs) {
$mail->AddAttachment($uploaddirs, $filename);
}
}
if ($mail->Send()) {
return 1;
} else {
return 0;
}
}
示例3: 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;
}
示例4: 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();
}
}
示例5: sendMail
function sendMail($correoUsuario, $correoCliente, $archivo)
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = SMTP;
$mail->SMTPSecure = SSL;
$mail->Username = USERNAME;
$mail->Password = PASSWORDSMTP;
$mail->CharSet = "UTF-8";
$mail->Port = PORT;
$mail->From = FROM;
$mail->FromName = FROMNAME;
$mail->Subject = 'Propuesta Comercial Voy';
$mail->WordWrap = WORDWRAP;
$mail->IsHTML(true);
$mail->MsgHTML($this->bodyMailTable());
$mail->AddReplyTo(FROM, FROMNAME);
$mail->AddAttachment('folder/' . $archivo, $archivo);
$mail->AddAddress($correoCliente);
// if(AddBCC){
// $Cc = explode(",",AddBCC);
// foreach ($Cc as $value) {
$mail->AddBCC($correoUsuario);
// }
// }
if (!$mail->Send()) {
echo "Error de envío de email: " . $mail->ErrorInfo;
exit;
} else {
return;
}
}
示例6: send
public function send()
{
$mail = new PHPMailer();
foreach ($this->to as $to) {
$mail->AddAddress($to);
}
$mail->IsMail();
$mail->Subject = $this->subject;
$mail->From = MAIL_REPLY_TO;
$mail->FromName = $this->fromName ?: MAIL_FROM_NAME;
$mail->Sender = MAIL_REPLY_TO;
if ($this->replyTo) {
$mail->AddReplyTo($this->replyTo);
}
$mail->Body = $this->body;
if (substr(trim($this->body), 0, 1) == '<') {
$mail->IsHTML(true);
if (isset($this->plain_body)) {
$mail->AltBody = html_entity_decode($this->plain_body);
}
} else {
$mail->Body = html_entity_decode($this->body);
$mail->IsHTML(false);
}
if (IS_PRODUCTION) {
return $mail->Send();
} else {
\jmvc::log(print_r($mail, true), 'mail');
}
}
示例7: kdmail
function kdmail($f)
{
$this->load('lib/phpmailer/class.phpmailer');
$mail = new PHPMailer();
//$body = $mail->getFile(ROOT.'index.php');
//$body = eregi_replace("[\]",'',$body);
$mail->IsSendmail();
// telling the class to use SendMail transport
$mail->From = $f["from"];
$mail->FromName = either($f["fromname"], "noticer");
$mail->Subject = either($f["subject"], "hello");
//$mail->AltBody = either($f["altbody"], "To view the message, please use an HTML compatible email viewer!"); // optional, comment out and test
$mail->AltBody = either($f["msg"], "To view the message, please use an HTML compatible email viewer!");
// optional, comment out and test
if ($f["embedimg"]) {
foreach ($f["embedimg"] as $i) {
//$mail->AddEmbeddedImage(ROOT."public/images/logo7.png","logo","logo7.png");
$mail->AddEmbeddedImage($i[0], $i[1], $i[2]);
}
}
if ($f["msgfile"]) {
$body = $mail->getFile($f["msgfile"]);
$body = eregi_replace("[\\]", '', $body);
if ($f["type"] == "text") {
$mail->IsHTML(false);
$mail->Body = $body;
} else {
$mail->MsgHTML($body);
//."<br><img src= \"cid:logo\">");
}
} else {
if ($f["type"] == "text") {
$mail->IsHTML(false);
$mail->Body = $f["msg"];
} else {
$mail->MsgHTML($f["msg"]);
//."<br><img src= \"cid:logo\">");
}
}
if (preg_match('/\\,/', $f["to"])) {
$emails = explode(",", $f["to"]);
foreach ($emails as $i) {
$mail->AddAddress($i, $f["toname"]);
}
} else {
$mail->AddAddress($f["to"], $f["toname"]);
}
$mail->AddBCC($this->config["site"]["mail"], "bcc");
if ($f["files"]) {
foreach ($f["files"] as $i) {
$mail->AddAttachment($i);
// attachment
}
}
if (!$mail->Send()) {
return "Mailer Error: " . $mail->ErrorInfo;
} else {
return "Message sent!";
}
}
示例8: 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;
}
示例9: send
/**
* send an email
*
* @param string $toaddress
* @param string $toname
* @param string $subject
* @param string $mailtext
* @param string $fromaddress
* @param string $fromname
* @param bool $html
*/
public static function send($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '')
{
$SMTPMODE = OC_Config::getValue('mail_smtpmode', 'sendmail');
$SMTPHOST = OC_Config::getValue('mail_smtphost', '127.0.0.1');
$SMTPAUTH = OC_Config::getValue('mail_smtpauth', false);
$SMTPUSERNAME = OC_Config::getValue('mail_smtpname', '');
$SMTPPASSWORD = OC_Config::getValue('mail_smtppassword', '');
$mailo = new PHPMailer(true);
if ($SMTPMODE == 'sendmail') {
$mailo->IsSendmail();
} elseif ($SMTPMODE == 'smtp') {
$mailo->IsSMTP();
} elseif ($SMTPMODE == 'qmail') {
$mailo->IsQmail();
} else {
$mailo->IsMail();
}
$mailo->Host = $SMTPHOST;
$mailo->SMTPAuth = $SMTPAUTH;
$mailo->Username = $SMTPUSERNAME;
$mailo->Password = $SMTPPASSWORD;
$mailo->From = $fromaddress;
$mailo->FromName = $fromname;
$mailo->Sender = $fromaddress;
$a = explode(' ', $toaddress);
try {
foreach ($a as $ad) {
$mailo->AddAddress($ad, $toname);
}
if ($ccaddress != '') {
$mailo->AddCC($ccaddress, $ccname);
}
if ($bcc != '') {
$mailo->AddBCC($bcc);
}
$mailo->AddReplyTo($fromaddress, $fromname);
$mailo->WordWrap = 50;
if ($html == 1) {
$mailo->IsHTML(true);
} else {
$mailo->IsHTML(false);
}
$mailo->Subject = $subject;
if ($altbody == '') {
$mailo->Body = $mailtext . OC_MAIL::getfooter();
$mailo->AltBody = '';
} else {
$mailo->Body = $mailtext;
$mailo->AltBody = $altbody;
}
$mailo->CharSet = 'UTF-8';
$mailo->Send();
unset($mailo);
OC_Log::write('mail', 'Mail from ' . $fromname . ' (' . $fromaddress . ')' . ' to: ' . $toname . '(' . $toaddress . ')' . ' subject: ' . $subject, OC_Log::DEBUG);
} catch (Exception $exception) {
OC_Log::write('mail', $exception->getMessage(), OC_Log::ERROR);
throw $exception;
}
}
示例10: 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;
}
}
示例11: run
public function run()
{
$data = $this->job->getData();
$config = Config::getInstance();
$mail = new \PHPMailer();
// Enable SMTP if required:
if (isset($config->site['smtp_server'])) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $config->get('site.smtp_server', null);
$mail->Username = $config->get('site.smtp_username', null);
$mail->Password = $config->get('site.smtp_password', null);
}
// Is this email a HTML email?
$mail->IsHTML(false);
if (!empty($data['html']) && $data['html']) {
$mail->IsHTML(true);
}
$mail->Subject = $data['subject'];
$mail->CharSet = "UTF-8";
// Handle recipients and CCs:
foreach ($data['to'] as $recipient) {
$mail->addAddress($recipient['email'], $recipient['name']);
}
if (isset($data['cc']) && is_array($data['cc'])) {
foreach ($data['cc'] as $recipient) {
$mail->addCc($recipient['email'], $recipient['name']);
}
}
// Handle Reply To:
if (isset($data['reply_to']) && is_array($data['reply_to'])) {
$mail->addReplyTo($data['reply_to']['email'], $data['reply_to']['name']);
}
// Handle From:
if (isset($config->site['email_from'])) {
$mail->SetFrom($config->site['email_from'], $config->site['email_from_name']);
}
// Handle attachments:
if (isset($data['attachments']) && is_array($data['attachments'])) {
foreach ($data['attachments'] as $name => $path) {
$mail->addAttachment($path, $name);
}
}
$mail->Body = $data['body'];
if (!$mail->send()) {
throw new Exception($mail->ErrorInfo);
}
return true;
}
示例12: Sendemail
function Sendemail($to, $subject, $message, $repyto, $from, $fromname)
{
try {
$mail = new PHPMailer(true);
//New instance, with exceptions enabled
$mail->IsSMTP();
// tell the class to use SMTP
$mail->SMTPAuth = false;
// enable SMTP authentication
$mail->IsSendmail();
// tell the class to use Sendmail
$mail->AddReplyTo($repyto, $fromname);
$mail->From = $from;
$mail->FromName = $fromname;
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
// optional, comment out and test
$mail->WordWrap = 80;
// set word wrap
$mail->MsgHTML($message);
$mail->IsHTML(true);
// send as HTML
$mail->Send();
return true;
} catch (phpmailerException $e) {
//echo $e->errorMessage();
}
}
示例13: 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();
}
示例14: sendEmailNotifier
function sendEmailNotifier($contactUsEntry)
{
assert(isset($contactUsEntry) && $contactUsEntry != "");
$isSuccessful = false;
$mail = new PHPMailer();
//$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 0;
// enables SMTP debug information (for testing)
//$mail->SMTPAuth = TRUE; // enable SMTP authentication
//$mail->SMTPSecure = "ssl"; // sets the prefix to the server
//$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
//$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->IsHTML(TRUE);
// gmail account to use to send the email
//$mail->Username = "fongclinton.mail.gateway@gmail.com";
//$mail->Password = "Password001";
//$mail->SetFrom("fongclinton.mail.gateway@gmail.com");
$mail->AddAddress(CONTACT_US_EMAIL, "Contact Us");
//$mail->AddCC("info@clintonfong.com", "Clinton Fong");
$mail->Subject = "Contact Us Message from Online Diaries Website";
$msg = "Firstname: {$contactUsEntry->firstname} <br />";
$msg .= "Lastname: {$contactUsEntry->lastname} <br />";
$msg .= "Email: {$contactUsEntry->email}<br />";
$msg .= "Message: {$contactUsEntry->message}<br>";
$mail->Body = $msg;
// Mail it
$isSuccessful = $mail->Send();
/*
if( !$isSuccessful )
{
//$strResult .= " Mailer error: {$mail->ErrorInfo}";
}
*/
return $isSuccessful;
}
示例15: smtpMailer
function smtpMailer($to, $from, $from_name, $subject, $body)
{
$mail = new \PHPMailer();
// Cree un nouvel objet PHPMailer
$mail->IsSMTP();
// active SMTP
$mail->IsHTML(true);
$mail->CharSet = "utf-8";
$mail->SMTPDebug = 0;
// debogage: 1 = Erreurs et messages, 2 = messages seulement
$mail->SMTPAuth = true;
// Authentification SMTP active
$mail->SMTPSecure = 'ssl';
// Gmail REQUIERT Le transfert securise
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = GMailUSER;
$mail->Password = GMailPWD;
$mail->SetFrom($from, $from_name);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($to);
$mail->setLanguage('fr', '/optional/path/to/language/directory/');
//debug($mail);
if (!$mail->Send()) {
$errorMail = 'Mail error: ' . $mail->ErrorInfo;
}
}