本文整理汇总了PHP中Zend_Mail::setHeaderEncoding方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Mail::setHeaderEncoding方法的具体用法?PHP Zend_Mail::setHeaderEncoding怎么用?PHP Zend_Mail::setHeaderEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Mail
的用法示例。
在下文中一共展示了Zend_Mail::setHeaderEncoding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public static function execute($subject, $to, $from, $body)
{
sfOpenPNEApplicationConfiguration::registerZend();
$subject = mb_convert_kana($subject, 'KV');
$mailer = new Zend_Mail('iso-2022-jp');
$mailer->setHeaderEncoding(Zend_Mime::ENCODING_BASE64)->setFrom($from)->addTo($to)->setSubject(mb_encode_mimeheader($subject, 'iso-2022-jp'))->setBodyText(mb_convert_encoding($body, 'JIS', 'UTF-8'), 'iso-2022-jp', Zend_Mime::ENCODING_7BIT);
$result = $mailer->send();
Zend_Loader::registerAutoLoad('Zend_Loader', false);
return $result;
}
示例2: actionIndex
public function actionIndex()
{
$mail = new Zend_Mail('utf-8');
$mail->setHeaderEncoding(Zend_Mime::ENCODING_QUOTEDPRINTABLE);
$mail->addTo("alexander@example.com", "Alexander Makarov");
$mail->setFrom("robot@example.com", "Robot");
$mail->setSubject("Test email");
$mail->setBodyText("Hello, world!");
$mail->setBodyHtml("Hello, <strong>world</strong>!");
$mail->send();
echo "OK";
}
示例3: sendMail
public static function sendMail($to, $subject, $message)
{
$transport = new Zend_Mail_Transport_Smtp('smtp.yuekegu.com', self::$_config);
$mail = new Zend_Mail('UTF-8');
$mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
$mail->setBodyHtml($message);
$mail->setFrom('admin@yuekegu.com', 'Administrator');
// $mail->addTo(Yii::app()->params['mail'], Yii::app()->params['author']);
$mail->addTo($to, 'Receiver');
$mail->setSubject($subject);
$mail->send($transport);
UtilHelper::writeToFile($mail, 'a+');
}
示例4: actionIndex
public function actionIndex()
{
Yii::import('application.vendors.*');
require "Zend/Mail.php";
$mail = new Zend_Mail('utf-8');
$mail->setHeaderEncoding(Zend_Mime::ENCODING_QUOTEDPRINTABLE);
// change to your email
$mail->addTo("alexander@example.com", "Alexander Makarov");
$mail->setFrom("robot@example.com", "Robot");
$mail->setSubject("Test email");
$mail->setBodyText("Hello, world!");
$mail->setBodyHtml("Hello, <strong>world</strong>!");
$mail->send();
echo "OK";
}
示例5: sendEmail
private function sendEmail($emailMessage, $recipients)
{
$mailerConfig = Zend_Registry::get("config")->mail;
$transport = new Zend_Mail_Transport_Smtp($mailerConfig->host, $mailerConfig->smtpconfig->toArray());
Zend_Mail::setDefaultTransport($transport);
$email = new Zend_Mail('UTF-8');
$email->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
$email->addHeader('Content-type', 'text/html');
$email->setFrom($emailMessage->getSenderAddress(), $emailMessage->getSenderName());
$email->setSubject($emailMessage->getSubject());
$email->setBodyHtml($emailMessage->getBody(), 'UTF-8');
foreach ($recipients as $recipient) {
$email->addBcc($recipient->getAddress(), $recipient->getName());
}
$email->send();
}
示例6: sendExternalMailToStudent
public function sendExternalMailToStudent($studentId, $subj, $text)
{
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$select = $db->select()->from('users')->where("u_id={$studentId}");
$stmp = $select->query();
$res = $stmp->fetchAll();
$external = $res[0]['u_external_emails'];
if (!$external) {
return;
}
$username = $res[0]['u_name'];
$userfamilyname = $res[0]['u_family_name'];
$email = $res[0]['u_email'];
$mail = new Zend_Mail('UTF-8');
$mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
$mail->setBodyHtml($text)->setFrom("no-reply@tipulitonline.co.il", "Admin")->addTo($email)->setSubject($subj);
// $mail->send();
}
示例7: newUserCeated
public function newUserCeated($data)
{
$config = array('auth' => 'login', 'username' => 'USERNAME', 'password' => 'SENHAGMAIL', 'ssl' => 'ssl', 'port' => 465);
// Optional port number supplied
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/modules/home/views/helpers/emails');
$html->assign('name', $data['name']);
$html->assign('login', $data['login']);
$html->assign('date', date('d/m/Y H:i:s', $data['timestamp']));
$mail = new Zend_Mail("UTF-8");
$bodyText = $html->render('newUser.phtml');
$mail->setFrom(self::$fromEmail, self::$fromName);
$mail->addTo('9892345@gmail.com');
$mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
$mail->setSubject('Novo usuário cadastrado!');
$mail->setBodyHtml($bodyText);
$mail->send($transport);
}
示例8: mail
function mail($data)
{
$mail = new Zend_Mail('utf-8');
$mail->setType(Zend_Mime::MULTIPART_ALTERNATIVE);
$mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
$body = $this->view->partial('mail/frame.phtml', array('message' => @$data['body'] ? $data['body'] : $this->view->partial('mail/' . $data['view'] . '.phtml', $data)));
preg_match_all('/src\\=\\"\\/(img|upload\\/mce\\/image)\\/([^\\"]+)\\"/si', $body, $res);
if (@$res[1]) {
$r = array();
foreach ($res[1] as $k => $v) {
$fn = PUBLIC_PATH . '/' . $res[1][$k] . '/' . $res[2][$k];
$s = getimagesize($fn);
if ($s) {
$cid = md5($res[1][$k] . '/' . $res[2][$k]);
$at = $mail->createAttachment(file_get_contents($fn), $s['mime'], Zend_Mime::DISPOSITION_INLINE, Zend_Mime::ENCODING_BASE64);
$at->id = $cid;
$r[] = 'src="cid:' . $cid . '"';
} else {
$r[] = $res[0][$k];
}
}
$body = str_ireplace($res[0], $r, $body);
}
preg_match_all('/href\\=\\"\\/upload\\/mce\\/file\\/([^\\"]+)\\"/si', $body, $res);
if (@$res[1]) {
$r = array();
foreach ($res[1] as $k => $v) {
$fn = PUBLIC_PATH . '/upload/mce/file/' . $res[1][$k];
$s = file_exists($fn);
if ($s) {
$cid = md5('upload/mce/file/' . $res[1][$k]);
$at = $mail->createAttachment(file_get_contents($fn), Zend_Mime::TYPE_OCTETSTREAM, Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, basename($fn));
$at->id = $cid;
$r[] = 'href="cid:' . $cid . '"';
} else {
$r[] = $res[0][$k];
}
}
$body = str_ireplace($res[0], $r, $body);
}
$mail->setBodyHtml($body);
$fm = $this->view->txt('site_mail');
$from = @$data['from'] ? $data['from'] : $this->view->txt('site_mail');
$to = @$data['to'] ? $data['to'] : $this->view->txt('site_mail');
$to = preg_split('/(\\;|\\,)/i', $to);
$reply_to = @$data['reply_to'];
$from_name = @$data['from_name'] ? $data['from_name'] : ($from == $fm ? $this->view->txt('site_title') : $from);
if ($reply_to) {
$mail->setReplyTo($reply_to, $from_name);
}
$mail->setFrom($from, $from_name);
$tn = @$data['to_name'] ? $data['to_name'] : $to;
foreach ($to as $n => $el) {
$el = trim($el);
if (!$el) {
continue;
}
$tn_el = is_array($tn) ? isset($tn[$n]) ? $tn[$n] : @$tn[0] : $tn;
$mail->addTo($el, $tn_el);
}
if (@$data['subject_full']) {
$mail->setSubject($data['subject_full']);
} else {
$mail->setSubject($this->view->txt('site_title') . ($data['subject'] ? ' — ' . $data['subject'] : ''));
}
$ok = false;
try {
$tr = null;
$bt = Zend_Controller_Front::getInstance()->getParam('bootstrap');
if ($bt) {
$config = $bt->getOptions();
if (@$config['mail']) {
if (@$config['mail']['transports'] && @$config['mail']['transports']['transport']) {
foreach ($config['mail']['transports']['transport'] as $k => $v) {
$class = 'Zend_Mail_Transport_' . ucfirst($v);
$tr = new $class($config['mail']['transports'][$v]['host'][$k], array('host' => $config['mail']['transports'][$v]['host'][$k], 'port' => $config['mail']['transports'][$v]['port'][$k], 'auth' => $config['mail']['transports'][$v]['auth'][$k], 'username' => $config['mail']['transports'][$v]['username'][$k], 'password' => $config['mail']['transports'][$v]['password'][$k], 'ssl' => $config['mail']['transports'][$v]['ssl'][$k]));
try {
$mail->send($tr);
$ok = true;
break;
} catch (Exception $e) {
//$ok = false;
//@file_put_contents(DATA_PATH.'/mail-'.time().microtime(true).'.txt', var_export($e, 1));
}
}
$tr = null;
} else {
if (@$config['mail']['transport']) {
$k = $config['mail']['transport'];
if (@$config['mail'][$k] && @$config['mail'][$k]['host']) {
try {
$class = 'Zend_Mail_Transport_' . ucfirst($k);
$tr = new $class($config['mail']['smtp']['host'], $config['mail'][$k]);
} catch (Exception $e) {
$tr = null;
//$ok = false;
}
}
}
}
//.........这里部分代码省略.........
示例9: getMailer
/**
*
* @return Zend_Mail
*/
public function getMailer()
{
$mail = new Zend_Mail('utf-8');
$mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
return $mail;
}
示例10: SendEmail
/**
* SendEmail
* Smtp Configuration.
* If you would like to use the smtp authentication, you have to add
* the parameters in the Setting Module of the Control Panel
*
* @param string $from
* @param string or array $to
* @param string $bcc
* @param string $subject
* @param string $body
* @param string $html
* @param string $inreplyto
* @param string/array $attachments
* @return boolean|multitype:unknown NULL
*/
public static function SendEmail($from, $to, $bcc = NULL, $subject, $body, $html = false, $inreplyto = NULL, $attachments = NULL, $replyto = NULL, $cc = null)
{
$transport = null;
$config = array();
$host = Settings::findbyParam('smtp_host');
if (!empty($host)) {
$username = Settings::findbyParam('smtp_user');
$password = Settings::findbyParam('smtp_password');
$port = Settings::findbyParam('smtp_port');
$port = !empty($port) ? $port : 25;
if (!empty($username) && !empty($password)) {
$config = array('auth' => 'login', 'username' => $username, 'password' => $password, 'port' => $port);
}
$transport = new Zend_Mail_Transport_Smtp($host, $config);
}
$mail = new Zend_Mail('UTF-8');
$mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
if (!empty($attachments)) {
if (is_array($attachments)) {
foreach ($attachments as $attachment) {
if (file_exists($attachment)) {
$filename = basename($attachment);
// Get the content of the file
$content = file_get_contents($attachment);
// Create the attachment
$zend_attachment = new Zend_Mime_Part($content);
$zend_attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
$zend_attachment->encoding = Zend_Mime::ENCODING_BASE64;
$zend_attachment->filename = $filename;
$mail->addAttachment($zend_attachment);
}
}
} else {
if (file_exists($attachments)) {
$filename = basename($attachments);
// Get the content of the file
$content = file_get_contents($attachments);
// Create the attachment
$zend_attachment = new Zend_Mime_Part($content);
$zend_attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
$zend_attachment->encoding = Zend_Mime::ENCODING_BASE64;
$zend_attachment->filename = $filename;
$mail->addAttachment($zend_attachment);
}
}
}
if (!empty($inreplyto)) {
$mail->addHeader("In-Reply-To", $inreplyto);
}
if (!empty($replyto)) {
$mail->setReplyTo($replyto);
}
// If the body of the message contains the HTML tags
// we have to override the $html variable in order to send the html message by email
if (self::isHtml($body)) {
$html = true;
}
if ($html) {
$mail->setBodyHtml($body, null, Zend_Mime::ENCODING_8BIT);
} else {
$mail->setBodyText($body);
}
if (is_array($from)) {
$mail->setFrom($from['email'], $from['name']);
} else {
$mail->setFrom($from);
}
// If the $to is a group of emails addresses
if (is_array($to)) {
foreach ($to as $recipient) {
$mail->addTo($recipient);
}
} else {
$mail->addTo($to);
}
if (!empty($bcc)) {
if (is_array($bcc) && count($bcc) > 0) {
foreach ($bcc as $b) {
$mail->addBcc($b);
}
} else {
$mail->addBcc($bcc);
}
}
//.........这里部分代码省略.........
示例11: execute
public static function execute($subject, $to, $from, $body)
{
if (!$to) {
return false;
}
self::initialize();
opApplicationConfiguration::registerZend();
$subject = mb_convert_kana($subject, 'KV');
$mailer = new Zend_Mail('iso-2022-jp');
$mailer->setHeaderEncoding(Zend_Mime::ENCODING_BASE64)->setFrom($from)->addTo($to)->setSubject(mb_encode_mimeheader($subject, 'iso-2022-jp'))->setBodyText(mb_convert_encoding($body, 'JIS', 'UTF-8'), 'iso-2022-jp', Zend_Mime::ENCODING_7BIT);
if ($envelopeFrom = sfConfig::get('op_mail_envelope_from')) {
$mailer->setReturnPath($envelopeFrom);
}
$result = $mailer->send();
Zend_Loader::registerAutoLoad('Zend_Loader', false);
return $result;
}
示例12: send
//.........这里部分代码省略.........
$bodyText = preg_replace('#\\[base64.*\\[\\/base64\\]#ui', '', $bodyText);
$bodyText = EhrlichAndreas_Util_Vsprintf::vsprintf($bodyText, $replacement, $vsprintfTimes - 1);
}
$bodyText = EhrlichAndreas_Util_Vsprintf::vsprintf($bodyText, $replacement, $vsprintfTimes);
}
*
*/
if (isset($conf['body']['text']) && strlen($conf['body']['text']) > 0) {
$bodyText = $conf['body']['text'];
if (!is_null($filter)) {
$bodyText = str_replace(' replacement=\'%replacement%\'', $tmp, $bodyText);
$bodyText = EhrlichAndreas_Util_Vsprintf::vsprintf($bodyText, $replacement, $vsprintfTimes);
} else {
for ($vsprintfTime = 0; $vsprintfTime < $vsprintfTimes; $vsprintfTime++) {
$bodyText = preg_replace('#\\[base64.*\\[/base64\\]#si', '', $bodyText);
$bodyText = str_replace(' replacement=\'%replacement%\'', '', $bodyText);
$bodyText = str_replace(' replacement=\'\'', '', $bodyText);
$bodyText = EhrlichAndreas_Util_Vsprintf::vsprintf($bodyText, $replacement);
}
}
}
if (!is_null($bodyText) && !is_null($filter)) {
$bodyText = call_user_func_array($filter, array($bodyText));
}
if (!is_null($bodyText)) {
$bodyText = preg_replace('#\\r?\\n|\\r\\n?#', $conf['eol'], $bodyText);
}
if ($conf['zfversion'] == 1) {
//require_once 'Zend/Mail.php';
$message = new Zend_Mail($conf['charset']);
$message->setHeaderEncoding($conf['encoding']);
} elseif ($conf['zfversion'] == 2) {
$classMailMessage = 'Zend\\Mail\\Message';
$message = new $classMailMessage();
$message->setEncoding($conf['charset']);
$classMimeMessage = 'Zend\\Mime\\Message';
$mimeBody = new $classMimeMessage();
$message->setBody($mimeBody);
$headers = $message->getHeaders();
$headers->setEncoding('ASCII');
}
$message->setFrom($fromEmail, $fromName);
if (!is_null($replytoEmail)) {
$message->setReplyTo($replytoEmail, $replytoName);
}
foreach ($toEmail as $key => $email) {
$name = $toName[$key];
$message->addTo($email, $name);
}
foreach ($ccEmail as $key => $email) {
$name = $ccName[$key];
$message->addCc($email, $name);
}
foreach ($bccEmail as $key => $email) {
$name = $bccName[$key];
$message->addBcc($email, $name);
}
if ($conf['zfversion'] == 1) {
foreach ($header as $key => $value) {
$message->addHeader($value['name'], $value['value'], $value['append']);
}
} elseif ($conf['zfversion'] == 2) {
$headers = $message->getHeaders();
示例13: sendWelcomeMail
public function sendWelcomeMail($email, $username, $userId)
{
$body = $body . "<p align='right' dir='RTL'>";
$body .= " {$username} ";
$body .= "שלום";
$body .= "<br/>";
$body .= "ברוכים הבאים לטיפולית אונליין. מייל זה נשלח באופן אוטומטי לאחר מילוי פרטים אישיים באתר ";
$body .= "<br/>";
$body .= "עימך קשר בזמן הקרוב בכדי להתאים לך תרגול יוגה אישי.";
$body .= "<br/><br/>";
$body .= "מרכז הלמידה שנפתח בעבורך הוא חלון לעולם של ידע אודות היוגה. מטרתו של מרכז ";
$body .= "<br/>";
$body .= "הלמידה הוא לעודד וללמד יוגה בבית וליישם את עקרונותיה בחיי היום יום. באמצעות מרכז ";
$body .= "<br/>";
$body .= "הלמידה אפשר להיות בקשר עם מדריכנו ולספק משוב על איכות התרגול, העדפות ובקשות ";
$body .= "<br/>";
$body .= "מיוחדות.";
$body .= "<br/><br/>";
$body .= "במרכז הלמידה מחכה לך עתה סרטון הסבר ראשון. את/ה מוזמנ/ת לצפות בסרטון וליישם ";
$body .= "<br/>";
$body .= "את עקרונות היוגה כבר בתרגול הראשון.";
$body .= "<br/><br/>";
$body .= "חשוב: עליך להודיע לנו על כל שינוי במצבך הבריאותי או על כל עניין גופני אחר הקשור ";
$body .= "<br/>";
$body .= "לתרגול כמו קושי מיוחד בביצוע התרגילים, כאב או מגבלה אחרת. נבקש ממך לדווח על כל ";
$body .= "<br/>";
$body .= "שיפור שחל בעקבות התרגול. היוגה שאנו מלמדים מעוררת כוחות ריפוי פנימיים. את/ה ";
$body .= "<br/>";
$body .= "מוזמנים לתרגל בקביעות ולהיעזר במרכז הלמידה.";
$body .= "<br/><br/>";
$body .= "צוות טיפולית אונליין עומד לרשותך במייל: ";
$body .= "<a href='info@tipulitonline.co.il'>info@tipulitonline.co.il</a>";
$body .= "<br/>";
$body .= "כתובת האינטרנט שלנו היא: ";
$body .= "<a href='http://www.tipulitonline.co.il'>tipulitonline.co.il</a>'";
$body .= "<br/><br/>";
$body .= "בברכה,";
$body .= "<br/><br/>";
$body .= "צוות טיפולית אונליין";
$body = $body . "</p>";
$mailExchange = new Student_Model_MailExchange();
$mailExchange->sendMessageFromTeacherToStudent($userId, 1, 'ברוכים הבאים לטיפולית אונליין', $body);
$mail = new Zend_Mail('UTF-8');
$mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
$mail->setBodyHtml($body)->setFrom("no-reply@tipulitonline.co.il", "טיפולית אונליין")->addTo($email)->setSubject("ברוכים הבאים לטיפולית אונליין");
$mail->send();
}
示例14: argsToArray
$opts->setOption('ignoreCase', true);
$options = $opts->parse();
$new = argsToArray($options);
print_r($new);
if (isset($opts->e)) {
echo "I got the a option " . $new["e"] . " \n";
$subject = "Teste zend " . Zend_Date::now();
$message = "<h2>Uma menssagem de teste em " . Zend_Date::now() . "</h2>";
//$tr = new Zend_Mail_Transport_Sendmail('contato@acaoparalela.com');
//Zend_Mail::setDefaultTransport($tr);
$mail = new Zend_Mail('utf-8');
$mail->addTo($new["e"]);
$mail->setSubject($subject);
$mail->setBodyHtml($message);
$mail->setFrom('contato@acaoparalela.com', 'Voluntário');
$mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
//print_r($mail);exit;
//Send it!
$sent = true;
try {
$mail->send();
echo "send teste \n";
} catch (Exception $e) {
print_r($e);
$sent = false;
}
//Do stuff (display error message, log it, redirect user, etc)
if ($sent) {
echo "Mail was sent successfully. \n";
} else {
echo "Mail failed to send. \n";
示例15: sendMail
protected function sendMail($subject, $address, $from, $body)
{
if (null === $this->transport) {
$this->transport = $this->getTransport();
}
// This code prevents memory leak.
$this->sendCount++;
if ($this->sendCount > 100) {
unset($this->transport);
$this->sendCount = 0;
$this->transport = $this->getTransport();
}
$subject = mb_convert_kana($subject, 'KV');
$mailer = new Zend_Mail('iso-2022-jp');
$mailer->setHeaderEncoding(Zend_Mime::ENCODING_BASE64)->setFrom($from)->addTo($address)->setSubject(mb_encode_mimeheader($subject, 'iso-2022-jp'))->setBodyText(mb_convert_encoding($body, 'JIS', 'UTF-8'), 'iso-2022-jp', Zend_Mime::ENCODING_7BIT);
if ($envelopeFrom = sfConfig::get('op_mail_envelope_from')) {
$mailer->setReturnPath($envelopeFrom);
}
$mailer->send($this->transport);
}