本文整理汇总了PHP中ezcMailTools::setLineBreak方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcMailTools::setLineBreak方法的具体用法?PHP ezcMailTools::setLineBreak怎么用?PHP ezcMailTools::setLineBreak使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcMailTools
的用法示例。
在下文中一共展示了ezcMailTools::setLineBreak方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmail
/**
* Mainfunction for mail send
*
* @param unknown_type $emailSender
* @param unknown_type $emailSenderName
* @param unknown_type $emailReceiver
* @param unknown_type $emailReceiverName
* @param unknown_type $emailSubject
* @param unknown_type $emailBodyArray
* @param boolean $isPreview
* @param string $emailCharset
* @return array
*/
public function sendEmail($emailSender, $emailSenderName, $emailReceiver, $emailReceiverName, $emailSubject, $emailBodyArray, $isPreview = false, $emailCharset = 'utf-8')
{
$transportMethod = $this->transportMethod;
//$mail = new ezcMailComposer();
$mail = new CjwNewsletterMailComposer();
$mail->charset = $emailCharset;
$mail->subjectCharset = $emailCharset;
// from and to addresses, and subject
$mail->from = new ezcMailAddress(trim($emailSender), $emailSenderName);
// returnpath for email bounces
$mail->returnPath = new ezcMailAddress(trim($emailSender));
if ($isPreview) {
$explodeReceiverArr = explode(';', $emailReceiver);
foreach ($explodeReceiverArr as $index => $receiver) {
// check if email
if ($receiver != '') {
$mail->addTo(new ezcMailAddress(trim($receiver), 'NL Test Receiver' . $index));
}
}
} else {
$mail->addTo(new ezcMailAddress(trim($emailReceiver), $emailReceiverName));
}
if (array_key_exists('html', $emailBodyArray) == false) {
$emailBodyArray['html'] = '';
}
if (array_key_exists('text', $emailBodyArray) == false) {
$emailBodyArray['text'] = '';
}
$mail->subject = $emailSubject;
if ($emailBodyArray['html'] == '') {
// tue nix - da kein html da ist
} else {
$mail->htmlText = $emailBodyArray['html'];
}
// body: plain
// $mail->plainText = "Here is the text version of the mail.";
if ($emailBodyArray['text'] == '') {
// $mail->plainText = "Text version of this mail does not exists.";
} else {
$mail->plainText = $emailBodyArray['text'];
}
$emailContentType = '';
if ($emailBodyArray['html'] != '' && $emailBodyArray['text'] != '') {
$emailContentType = 'multipart/alternative';
} else {
if ($emailBodyArray['html'] != '') {
$emailContentType = 'text/html';
} elseif ($emailBodyArray['text'] != '') {
$emailContentType = 'text/plain';
}
}
// http://ezcomponents.org/docs/api/latest/introduction_Mail.html#mta-qmail
// HeaderLineEnding=auto
// CRLF - windows - \r\n
// CR - mac - \r
// LF - UNIX-MACOSX - \n
// default LF
//ezcMailTools::setLineBreak( "\n" );
ezcMailTools::setLineBreak($this->HeaderLineEnding);
// set 'x-cjwnl-' mailheader
foreach ($this->ExtraEmailHeaderItemArray as $key => $value) {
$mail->setHeader($key, $value);
}
$mail->build();
$transport = new CjwNewsletterTransport($transportMethod);
$sendResult = $transport->send($mail);
$emailResult = array('send_result' => $sendResult, 'email_sender' => $emailSender, 'email_receiver' => $emailReceiver, 'email_subject' => $emailSubject, 'email_content_type' => $emailContentType, 'email_charset' => $emailCharset, 'transport_method' => $transportMethod);
// ok
if ($sendResult) {
CjwNewsletterLog::writeInfo('email send ok', 'CjwNewsletterMail', 'sendEmail', $emailResult);
} else {
CjwNewsletterLog::writeError('email send failed', 'CjwNewsletterMail', 'sendEmail', $emailResult);
}
// $LogFile->write( $message, $logName, $logFolder );
return $emailResult;
}
示例2: testEndline
public function testEndline()
{
// defaul is \n\r as specified in RFC2045
$this->assertEquals("\r\n", ezcMailTools::lineBreak());
// now let's set it and check that it works
ezcMailTools::setLineBreak("\n");
$this->assertEquals("\n", ezcMailTools::lineBreak());
}
示例3: sendEmail
/**
* Mainfunction for mail send
*
* @param unknown_type $emailSender
* @param unknown_type $emailSenderName
* @param unknown_type $emailReceiver
* @param unknown_type $emailReceiverName
* @param unknown_type $emailSubject
* @param unknown_type $emailBodyArray
* @param boolean $isPreview
* @param string $emailCharset
* @return array
*/
public function sendEmail($emailSender, $emailSenderName, $emailReceiver, $emailReceiverName, $emailSubject, $emailBodyArray, $isPreview = false, $emailCharset = 'utf-8', $emailReplyTo = false, $emailReturnPath = false)
{
$transportMethod = $this->transportMethod;
//$mail = new ezcMailComposer();
$mail = new CjwNewsletterMailComposer();
// Encode the UTF-8 as base64 or QUOTED_PRINTABLE for 7 bit MTAs
// $mail->encoding = ezcMail::BASE64;
// $mail->encoding = ezcMail::QUOTED_PRINTABLE;
$mail->encoding = $this->ContentTransferEncoding;
$mail->charset = $emailCharset;
$mail->subjectCharset = $emailCharset;
// from and to addresses, and subject
$mail->from = new ezcMailAddress(trim($emailSender), $emailSenderName, $mail->charset);
// returnpath for email bounces
if (!($emailReturnPath && $emailReturnPath != '')) {
$mail->returnPath = $mail->from;
} else {
$mail->returnPath = new ezcMailAddress(trim($emailReturnPath), '', $mail->charset);
}
$mail->setHeader('Errors-To', $mail->returnPath);
// reply-to
if (!($emailReplyTo && $emailReplyTo != '')) {
$mail->setHeader('Reply-To', $mail->from);
} else {
$mail->setHeader('Reply-To', new ezcMailAddress(trim($emailReplyTo), '', $mail->charset));
}
if ($isPreview) {
$explodeReceiverArr = explode(';', $emailReceiver);
foreach ($explodeReceiverArr as $index => $receiver) {
// check if email
if ($receiver != '') {
$mail->addTo(new ezcMailAddress(trim($receiver), 'NL Test Receiver' . $index, $mail->charset));
}
}
} else {
$mail->addTo(new ezcMailAddress(trim($emailReceiver), $emailReceiverName, $mail->charset));
}
if (array_key_exists('html', $emailBodyArray) == false) {
$emailBodyArray['html'] = '';
}
if (array_key_exists('text', $emailBodyArray) == false) {
$emailBodyArray['text'] = '';
}
$mail->subject = $emailSubject;
if ($emailBodyArray['html'] == '') {
// tue nix - da kein html da ist
} else {
$mail->htmlText = $emailBodyArray['html'];
}
// body: plain
// $mail->plainText = "Here is the text version of the mail.";
if ($emailBodyArray['text'] == '') {
// $mail->plainText = "Text version of this mail does not exists.";
} else {
$mail->plainText = $emailBodyArray['text'];
}
$emailContentType = '';
if ($emailBodyArray['html'] != '' && $emailBodyArray['text'] != '') {
$emailContentType = 'multipart/alternative';
} else {
if ($emailBodyArray['html'] != '') {
$emailContentType = 'text/html';
} elseif ($emailBodyArray['text'] != '') {
$emailContentType = 'text/plain';
}
}
// http://ezcomponents.org/docs/api/latest/introduction_Mail.html#mta-qmail
// HeaderLineEnding=auto
// CRLF - windows - \r\n
// CR - mac - \r
// LF - UNIX-MACOSX - \n
// default LF
//ezcMailTools::setLineBreak( "\n" );
ezcMailTools::setLineBreak($this->HeaderLineEnding);
// set 'x-cjwnl-' mailheader
foreach ($this->ExtraEmailHeaderItemArray as $key => $value) {
$mail->setHeader($key, $value, $mail->charset);
}
$mail->build();
$transport = new CjwNewsletterTransport($transportMethod);
$sendResult = $transport->send($mail);
$emailResult = array('send_result' => $sendResult, 'email_sender' => $emailSender, 'email_receiver' => $emailReceiver, 'email_subject' => $emailSubject, 'email_content_type' => $emailContentType, 'email_charset' => $emailCharset, 'transport_method' => $transportMethod);
// ok
if ($sendResult === true) {
CjwNewsletterLog::writeInfo('email send ok', 'CjwNewsletterMail', 'sendEmail', $emailResult);
} else {
// An error occured while sending or receiving mail. RCPT TO failed with error: 450 4.1.2
//.........这里部分代码省略.........