本文整理匯總了PHP中JMail::addReplyTo方法的典型用法代碼示例。如果您正苦於以下問題:PHP JMail::addReplyTo方法的具體用法?PHP JMail::addReplyTo怎麽用?PHP JMail::addReplyTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JMail
的用法示例。
在下文中一共展示了JMail::addReplyTo方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testAddReplyTo
/**
* Tests the addReplyTo method.
*
* @covers JMail::addReplyTo
*
* @return void
*/
public function testAddReplyTo()
{
$recipient = 'test@example.com';
$name = 'test_name';
$expected = array('test@example.com' => array('test@example.com', 'test_name'));
$this->object->addReplyTo($recipient, $name);
$this->assertThat($expected, $this->equalTo(TestReflection::getValue($this->object, 'ReplyTo')));
}
示例2: set_from
/**
* @param JMail $mail
*/
private function set_from(&$mail)
{
$emailhelper = new FoxEmailHelper($this->Params);
/** @var Joomla\Registry\Registry $config */
$config = JComponentHelper::getParams("com_foxcontact");
// Set a default value
$default = (object) array("select" => "admin", "email" => "", "name" => "");
$submitteremailfrom = $config->get("submitteremailfrom", $default);
$from = $emailhelper->convert($submitteremailfrom);
$mail->setSender($from);
$submitteremailreplyto = $config->get("submitteremailreplyto", $default);
$replyto = $emailhelper->convert($submitteremailreplyto);
// In Joomla 1.7 From and Reply-to fields is set by default to the Global admin email
// but a call to setSender() won't change the Reply-to field
$mail->ClearReplyTos();
$mail->addReplyTo($replyto[0], $replyto[1]);
}
示例3: sendEmail
public static function sendEmail($from, $fromName, $replyTo, $toEmail, $cc, $bcc, $subject, $content, $isHtml)
{
jimport('joomla.mail.mail');
$mail = new JMail();
$mail->setSender(array($from, $fromName));
if (isset($replyTo)) {
$mail->addReplyTo($replyTo);
}
$mail->addRecipient($toEmail);
if (isset($cc)) {
$mail->addCC($cc);
}
if (isset($bcc)) {
$mail->addBCC($bcc);
}
$mail->setSubject($subject);
$mail->setBody($content);
$mail->IsHTML($isHtml);
$ret = $mail->send();
$log = Logger::getInstance();
$log->LogDebug("E-mail with subject " . $subject . " sent from " . $from . " to " . $toEmail . " " . serialize($bcc) . " result:" . $ret);
return $ret;
}
示例4: getMailer
/**
* This function is used to override the send function in Joomla
*/
public static function getMailer($mailing, $html = 0)
{
$fromname = empty($mailing->fromname) ? trim($GLOBALS[JNEWS . 'sendmail_name']) : trim($mailing->fromname);
$fromemail = empty($mailing->fromemail) ? trim($GLOBALS[JNEWS . 'sendmail_email']) : trim($mailing->fromemail);
$frombounce = empty($mailing->frombounce) ? trim($GLOBALS[JNEWS . 'sendmail_from']) : trim($mailing->frombounce);
if (empty($fromemail)) {
$my = JFactory::getUser();
$userSender = jNews_Subscribers::getUsers('gid', '50', $my->id);
$fromemail = $userSender[0]->email;
if (empty($fromemail)) {
jnews::printM('no', 'The sender email needs to be specified in the configuration.');
return false;
}
}
if (empty($frombounce)) {
$frombounce = $fromemail;
}
$attachments = $mailing->attachments;
$images = $mailing->images;
$conf = JFactory::getConfig();
$frombounceName = $fromname ? $fromname : $conf->get('config.fromname');
if (empty($fromemail)) {
$fromemail = trim($conf->get('config.mailfrom'));
}
if (empty($fromname)) {
$fromname = trim($conf->get('config.fromname'));
}
jimport('joomla.mail.mail');
$phpmailerPath = JPATH_LIBRARIES . DS . 'phpmailer' . DS;
$mail = new JMail();
$mail->PluginDir = $phpmailerPath;
$mail->SetLanguage('en', $phpmailerPath . 'language' . DS);
$mail->WordWrap = 150;
// $mail->addCustomHeader("X-Mailer: ".JNEWS_JPATH_LIVE);
// $mail->addCustomHeader("X-MessageID: $mailing->id");
if ($GLOBALS[JNEWS . 'mail_format'] == '1') {
$mail->Encoding = 'base64';
}
if ($GLOBALS[JNEWS . 'minisendmail']) {
$frombounceName = '';
}
if (!empty($frombounce)) {
if (version_compare(JVERSION, '3.0.0', '<')) {
$mail->addReplyTo(array($frombounce, $frombounceName));
} else {
$mail->addReplyTo(array($frombounce));
}
JRequest::setVar('bounceBackEmail', $frombounce);
}
$mail->From = trim($fromemail);
if ($GLOBALS[JNEWS . 'minisendmail']) {
$mail->FromName = '';
} else {
$mail->FromName = $fromname;
}
$mail->Sender = trim($GLOBALS[JNEWS . 'sendmail_from']);
if (empty($mail->Sender)) {
$mail->Sender = '';
}
switch ($GLOBALS[JNEWS . 'emailmethod']) {
case 'mail':
$mail->IsMail();
break;
case 'sendmail':
$mail->IsSendmail();
$mail->Sendmail = $GLOBALS[JNEWS . 'sendmail_path'] ? $GLOBALS[JNEWS . 'sendmail_path'] : $conf->get('config.sendmail');
break;
case 'smtp':
$mail->IsSMTP();
$mail->Host = $GLOBALS[JNEWS . 'smtp_host'] ? $GLOBALS[JNEWS . 'smtp_host'] : $conf->get('config.smtphost');
$mail->Port = $GLOBALS[JNEWS . 'smtp_port'] ? $GLOBALS[JNEWS . 'smtp_port'] : $conf->get('config.smtpport');
$mail->SMTPSecure = $GLOBALS[JNEWS . 'smtp_secure'] ? $GLOBALS[JNEWS . 'smtp_secure'] : '';
if ((bool) $GLOBALS[JNEWS . 'smtp_auth_required']) {
$mail->SMTPAuth = $GLOBALS[JNEWS . 'smtp_auth_required'];
$mail->Password = $GLOBALS[JNEWS . 'smtp_password'];
$mail->Username = $GLOBALS[JNEWS . 'smtp_username'];
}
break;
default:
$mail->Mailer = $conf->get('config.mailer');
break;
}
if (!empty($attachments)) {
foreach ($attachments as $attachment) {
if (basename($attachment) !== 'index.html') {
$mail->AddAttachment(JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'upload_url'] . DS . basename($attachment));
}
}
}
switch (substr(strtoupper(PHP_OS), 0, 3)) {
case "WIN":
$mail->LE = "\r\n";
break;
case "MAC":
case "DAR":
$mail->LE = "\r";
default:
//.........這裏部分代碼省略.........