当前位置: 首页>>代码示例>>PHP>>正文


PHP TikiMail::setFrom方法代码示例

本文整理汇总了PHP中TikiMail::setFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP TikiMail::setFrom方法的具体用法?PHP TikiMail::setFrom怎么用?PHP TikiMail::setFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TikiMail的用法示例。


在下文中一共展示了TikiMail::setFrom方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendMail

/**
 *
 * Sends a promotional email to the given recipients
 * @param string        $sender        Sender e-Mail address
 * @param string|array    $recipients    List of recipients either as array or comma/semi colon separated string
 * @param string        $subject    E-Mail subject
 * @param array            $tokenlist
 * @internal param string $url_for_friend URL to share
 * @return bool                        true on success / false if the supplied parameters were incorrect/missing or an error occurred sending the mail
 */
function sendMail($sender, $recipients, $subject, $tokenlist = array())
{
    global $errors, $prefs, $smarty, $user, $userlib, $logslib;
    global $registrationlib;
    include_once 'lib/registration/registrationlib.php';
    if (empty($sender)) {
        $errors[] = tra('Your email is mandatory');
        return false;
    }
    if (function_exists('validate_email')) {
        $ok = validate_email($sender, $prefs['validateEmail']);
    } else {
        $ret = $registrationlib->SnowCheckMail($sender, '', 'mini');
        $ok = $ret[0];
    }
    if ($ok) {
        $from = str_replace(array("\r", "\n"), '', $sender);
    } else {
        $errors[] = tra('Invalid email') . ': ' . $_REQUEST['email'];
        return false;
    }
    $recipients = checkAddresses($recipients);
    if ($recipients === false) {
        return false;
    }
    include_once 'lib/webmail/tikimaillib.php';
    $smarty->assign_by_ref('mail_site', $_SERVER['SERVER_NAME']);
    $applyFrom = !empty($user) && $from == $userlib->get_user_email($user);
    $ok = true;
    foreach ($recipients as $i => $recipient) {
        $mail = new TikiMail();
        $mail->setSubject($subject);
        if ($applyFrom) {
            $mail->setFrom($from);
            $mail->setReplyTo("<{$from}>");
        }
        if (count($tokenlist) > 1) {
            $url_for_friend = $tokenlist[$i];
        } else {
            $url_for_friend = $tokenlist[0];
            // only one token if not "subscribing"
        }
        $smarty->assign('url_for_friend', $url_for_friend);
        $txt = $smarty->fetch('mail/share.tpl');
        // Rebuild email message texte
        $mail->setText($txt);
        $mailsent = $mail->send(array($recipient));
        if (!$mailsent) {
            $errors[] = tra('Error sending mail to') . " {$recipient}";
            $logslib->add_log('share', tra('Error sending mail to') . " {$recipient} " . tra('by') . ' ' . $user);
        } else {
            $logslib->add_log('share', tra('Share page') . ': ' . $url_for_friend . ' ' . tra('to') . ' ' . $recipient . ' ' . tra('by') . ' ' . $user);
        }
        $ok = $ok && $mailsent;
    }
    return $ok;
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:67,代码来源:tiki-share.php

示例2: MAX

							empty($_REQUEST['wikipageafter']) ? NULL : $_REQUEST['wikipageafter']
						)
		);
      $res=$tikilib->query("SELECT MAX(id) as `id` FROM `tiki_invite` WHERE `inviter`=? AND `ts`=?", array($user, $tikilib->now));
        $row=$res->fetchRow(); $id=$row['id'];
        
      foreach ($emails as $m)
						$tikilib->query(
										"INSERT INTO `tiki_invited` (id_invite, email, firstname, lastname, used) VALUES (?,?,?,?,?)",
										array($id, $m['email'], $m['firstname'], $m['lastname'], "no")
						);

		  $_SERVER['SCRIPT_URI'] =  empty($_SERVER['SCRIPT_URI']) ? 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_URI'];			        
        foreach ($emails as $m) {
            $mail = new TikiMail();
            $mail->setFrom($prefs['sender_email']);
            $mail->setSubject($_REQUEST["emailsubject"]);
            $mail->setCrlf("\n");
            $url=str_replace('tiki-invite.php', 'tiki-invited.php', $_SERVER['SCRIPT_URI'])
                .'?invite='.$id.'&email='.urlencode($m['email']);
            $text=$_text;
            $text=str_replace('{link}', $url, $text);
            $text=str_replace('{email}', $m['email'], $text);
            $text=str_replace('{firstname}', $m['firstname'], $text);
            $text=str_replace('{lastname}', $m['lastname'], $text);
            $mail->setText($text);
            $mail->send(array($m['email']));
        }
		
        $smarty->assign('sentresult', true);
	}
开发者ID:railfuture,项目名称:tiki-website,代码行数:31,代码来源:tiki-invite.php

示例3: array

 $errors = array();
 $users = $nllib->get_all_subscribers($_REQUEST["nlId"], $nl_info["unsubMsg"]);
 foreach ($users as $us) {
     $userEmail = $us["login"];
     $email = $us["email"];
     if ($email == "") {
         $errors[] = array("user" => $userEmail, "email" => "");
         continue;
     }
     if ($userEmail == "") {
         $userEmail = $userlib->get_user_by_email($email);
     }
     if ($userEmail) {
         $mail->setUser($userEmail);
     }
     $mail->setFrom($tikilib->get_preference("sender_email", ""));
     $mail->setSubject($_REQUEST["subject"]);
     // htmlMimeMail memorised the encoded subject
     $languageEmail = !$userEmail ? $language : $tikilib->get_user_preference($userEmail, "language", $language);
     if ($nl_info["unsubMsg"] == 'y') {
         $unsubmsg = $nllib->get_unsub_msg($_REQUEST["nlId"], $userEmail, $languageEmail, $us["code"], $userEmail);
         if (stristr($html, "</body>") === false) {
             $msg = $html . nl2br($unsubmsg);
         } else {
             $msg = str_replace("</body>", nl2br($unsubmsg) . "</body>", $html);
         }
     } else {
         $msg = $html;
     }
     $mail->setHtml($msg, $txt . strip_tags($unsubmsg));
     $mail->buildMessage();
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:tiki-send_newsletters.php

示例4: header

 $current = $webmaillib->get_current_webmail_account($user);
 if (!$current) {
     header("location: tiki-webmail.php?locSection=settings");
     die;
 }
 // Send a message
 if (isset($_REQUEST["reply"]) || isset($_REQUEST["replyall"])) {
     check_ticket('webmail');
     $webmaillib->set_mail_flag($current["accountId"], $user, $_REQUEST["realmsgid"], 'isReplied', 'y');
 }
 $smarty->assign('sent', 'n');
 $smarty->assign('attaching', 'n');
 if (isset($_REQUEST["send"])) {
     $mail = new TikiMail($user);
     $email = $userlib->get_user_email($user);
     $mail->setFrom($email);
     if (!empty($_REQUEST["cc"])) {
         $mail->setCc($_REQUEST["cc"]);
     }
     if (!empty($_REQUEST["bcc"])) {
         $mail->setBcc($_REQUEST["bcc"]);
     }
     $mail->setSubject($_REQUEST["subject"]);
     if ($_REQUEST["attach1"]) {
         check_ticket('webmail');
         $a1 = $mail->getFile('temp/mail_attachs/' . $_REQUEST["attach1file"]);
         $mail->addAttachment($a1, $_REQUEST["attach1"], $_REQUEST["attach1type"]);
         @unlink('temp/mail_attachs/' . $_REQUEST["attach1file"]);
     }
     if ($_REQUEST["attach2"]) {
         check_ticket('webmail');
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:31,代码来源:tiki-webmail.php

示例5: values

 /**
  * Send a message to a user with gpg-armor block etc included
  * A changed encryption-related version was copied/changed from lib/messu/messulib.pgp
  * into lib/openpgp/openpgplib.php for prepending/appending content into
  * message body
  * @param  string	$user
  * @param  string	$from
  * @param  string	$to
  * @param  string	$cc
  * @param  string	$subject
  * @param  string	$body
  * @param  string	$prepend_email_body
  * @param  string	$user_pubkeyarmor
  * @param  string	$priority
  * @param  string	$replyto_hash
  * @param  string	$replyto_email
  * @param  string	$bcc_sender
  * @access public
  * @return boolean	true/false
  */
 function post_message_with_pgparmor_attachment($user, $from, $to, $cc, $subject, $body, $prepend_email_body, $user_pubkeyarmor, $priority, $replyto_hash = '', $replyto_email = '', $bcc_sender = '')
 {
     global $prefs;
     $userlib = TikiLib::lib('user');
     $tikilib = TikiLib::lib('tiki');
     $smarty = TikiLib::lib('smarty');
     $subject = strip_tags($subject);
     $body = strip_tags($body, '<a><b><img><i>');
     // Prevent duplicates
     $hash = md5($subject . $body);
     if ($tikilib->getOne("select count(*) from `messu_messages` where `user`=? and `user_from`=? and `hash`=?", array($user, $from, $hash))) {
         return false;
     }
     $query = "insert into `messu_messages`(`user`,`user_from`,`user_to`,`user_cc`,`subject`,`body`,`date`,`isRead`,`isReplied`,`isFlagged`,`priority`,`hash`,`replyto_hash`) values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
     $tikilib->query($query, array($user, $from, $to, $cc, $subject, $body, (int) $tikilib->now, 'n', 'n', 'n', (int) $priority, $hash, $replyto_hash));
     // Now check if the user should be notified by email
     $foo = parse_url($_SERVER["REQUEST_URI"]);
     $machine = $tikilib->httpPrefix(true) . $foo["path"];
     $machine = str_replace('messu-compose', 'messu-mailbox', $machine);
     if ($tikilib->get_user_preference($user, 'minPrio', 6) <= $priority) {
         if (!isset($_SERVER["SERVER_NAME"])) {
             $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
         }
         $email = $userlib->get_user_email($user);
         if ($email) {
             include_once 'lib/webmail/tikimaillib.php';
             $smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
             $smarty->assign('mail_machine', $machine);
             $smarty->assign('mail_date', $tikilib->now);
             $smarty->assign('mail_user', stripslashes($user));
             $smarty->assign('mail_from', stripslashes($from));
             $smarty->assign('mail_subject', stripslashes($subject));
             ////////////////////////////////////////////////////////////////////////
             //                                                                    //
             // ALPHAFIELDS 2012-11-03: ADDED PGP/MIME ENCRYPTION PREPARATION      //
             // USING lib/openpgp/opepgplib.php                                    //
             //                                                                    //
             // prepend original headers into email                                //
             $aux_body = $prepend_email_body . $body;
             $body = $aux_body;
             //                                                                    //
             ////////////////////////////////////////////////////////////////////////
             $smarty->assign('mail_body', stripslashes($body));
             $mail = new TikiMail($user);
             $lg = $tikilib->get_user_preference($user, 'language', $prefs['site_language']);
             if (empty($subject)) {
                 $s = $smarty->fetchLang($lg, 'mail/messu_message_notification_subject.tpl');
                 $mail->setSubject(sprintf($s, $_SERVER["SERVER_NAME"]));
             } else {
                 $mail->setSubject($subject);
             }
             $mail_data = $smarty->fetchLang($lg, 'mail/messu_message_notification.tpl');
             ////////////////////////////////////////////////////////////////////////
             //                                                                    //
             // ALPHAFIELDS 2012-11-03: ADDED PGP/MIME ENCRYPTION PREPARATION      //
             // USING lib/openpgp/opepgplib.php                                    //
             //                                                                    //
             // append pgparmor block and fingerprint into email                   //
             $mail_data .= $user_pubkeyarmor;
             //                                                                    //
             ////////////////////////////////////////////////////////////////////////
             $mail->setText($mail_data);
             if ($userlib->user_exists($from)) {
                 $from_email = $userlib->get_user_email($from);
                 if ($bcc_sender === 'y' && !empty($from_email)) {
                     $mail->setBcc($from_email);
                 }
                 if ($replyto_email !== 'y' && $userlib->get_user_preference($from, 'email is public', 'n') == 'n') {
                     $from_email = '';
                     // empty $from_email if not to be used - saves getting it twice
                 }
                 if (!empty($from_email)) {
                     $mail->setReplyTo($from_email);
                 }
             }
             if (!empty($from_email)) {
                 $mail->setFrom($from_email);
             }
             if (!$mail->send(array($email), 'mail')) {
                 return false;
//.........这里部分代码省略.........
开发者ID:rjsmelo,项目名称:tiki,代码行数:101,代码来源:openpgplib.php

示例6: wikiplugin_tracker


//.........这里部分代码省略.........
                        $url[0] = $wikilib->sefurl($newpagename);
                    }
                }
                // end wiki output
                // send emails if email param is set and tracker_always_notify or something was changed (mail_data is set in \TrackerLib::send_replace_item_notifications)
                if (!empty($email) && ($prefs['tracker_always_notify'] === 'y' || !empty($smarty->getTemplateVars('mail_data')))) {
                    // expose the pretty tracker fields to the email tpls
                    foreach ($flds['data'] as $f) {
                        $prettyout = strip_tags(wikiplugin_tracker_render_value($f, $item));
                        $smarty->assign('f_' . $f['fieldId'], $prettyout);
                        $smarty->assign('f_' . $f['permName'], $prettyout);
                    }
                    $emailOptions = preg_split("#\\|#", $email);
                    if (is_numeric($emailOptions[0])) {
                        $emailOptions[0] = $trklib->get_item_value($trackerId, $rid, $emailOptions[0]);
                    }
                    if (empty($emailOptions[0])) {
                        // from
                        $emailOptions[0] = $prefs['sender_email'];
                    }
                    if (empty($emailOptions[1])) {
                        // to
                        $emailOptions[1][0] = $prefs['sender_email'];
                    } else {
                        $emailOptions[1] = preg_split('/ *, */', $emailOptions[1]);
                        foreach ($emailOptions[1] as $key => $email) {
                            if (is_numeric($email)) {
                                $emailOptions[1][$key] = $trklib->get_item_value($trackerId, $rid, $email);
                            }
                        }
                    }
                    include_once 'lib/webmail/tikimaillib.php';
                    $mail = new TikiMail();
                    $mail->setFrom($emailOptions[0]);
                    if (!empty($emailOptions[2])) {
                        //tpl
                        $emailOptions[2] = preg_split('/ *, */', $emailOptions[2]);
                        foreach ($emailOptions[2] as $ieo => $eo) {
                            if (!preg_match('/\\.tpl$/', $eo)) {
                                $emailOptions[2][$ieo] = $eo . '.tpl';
                            }
                            $tplSubject[$ieo] = str_replace('.tpl', '_subject.tpl', $emailOptions[2][$ieo]);
                        }
                    } else {
                        $emailOptions[2] = array('tracker_changed_notification.tpl');
                    }
                    if (empty($tplSubject)) {
                        $tplSubject = array('tracker_changed_notification_subject.tpl');
                    }
                    $itpl = 0;
                    $smarty->assign('mail_date', $tikilib->now);
                    $smarty->assign('mail_itemId', $rid);
                    foreach ($emailOptions[1] as $ieo => $ueo) {
                        @($mail_data = $smarty->fetch('mail/' . $tplSubject[$itpl]));
                        if (empty($mail_data)) {
                            $mail_data = tra('Tracker was modified at ') . $_SERVER["SERVER_NAME"];
                        }
                        $mail->setSubject($mail_data);
                        $mail_data = $smarty->fetch('mail/' . $emailOptions[2][$itpl]);
                        if ($emailformat == 'html') {
                            $mail->setHtml($mail_data);
                        } else {
                            $mail->setText($mail_data);
                        }
                        try {
                            $mail->send($ueo);
开发者ID:ameoba32,项目名称:tiki,代码行数:67,代码来源:wikiplugin_tracker.php

示例7: TikiMail

                     $body = $body . $info['data'];
                 }
                 $tikilib->update_page($page, $body, "Created from " . $acc["account"], $aux["sender"]["user"], '0.0.0.0', '', 0, '', $parsed_data['is_html'], '', null, $parsed_data['wysiwyg']);
                 $errorMsg = "Page: {$page} has been updated by email: " . $fromEmail . "<br />";
                 $logslib->add_log('mailin', mailin_preplog($errorMsg), $logUser);
                 $content .= $errorMsg;
                 $hasError = false;
             }
         }
     }
 } else {
     //////////////
     //	Invalid mail-in type
     //////////////////////////////////////////////////////////////////////////////////
     $mail = new TikiMail();
     $mail->setFrom($acc["account"]);
     $l = $prefs['language'];
     $mail_data = $smarty->fetchLang($l, "mail/mailin_help_subject.tpl");
     $mail->setSubject($mail_data);
     $smarty->assign('subject', $output['header']['subject']);
     $mail_data = $smarty->fetchLang($l, "mail/mailin_help.tpl");
     $mail->setText($mail_data);
     if ($acc['respond_email'] === 'y') {
         $res = $mail->send(array($email_from), 'mail');
         $content .= "Help response sent<br />";
     } else {
         $content .= "Response by email is disabled<br />";
     }
     $errorMsg = "Invalid mail-in type";
     $logslib->add_log('mailin', mailin_preplog($errorMsg), $logUser);
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:31,代码来源:tiki-mailin-code.php

示例8: foreach

 foreach ($users as $us) {
     $userEmail = $us["login"];
     $email = $us["email"];
     if ($email == "") {
         $errors[] = array("user" => $userEmail, "email" => "");
         continue;
     }
     if ($userEmail == "") {
         $userEmail = $userlib->get_user_by_email($email);
     }
     if ($userEmail) {
         $mail->setUser($userEmail);
     } else {
         $userEmail = '';
     }
     $mail->setFrom($sender_email);
     $mail->setSubject($_REQUEST["subject"]);
     // htmlMimeMail memorised the encoded subject
     $languageEmail = !$userEmail ? $prefs['site_language'] : $tikilib->get_user_preference($userEmail, "language", $prefs['site_language']);
     if ($nl_info["unsubMsg"] == 'y') {
         $unsubmsg = $nllib->get_unsub_msg($_REQUEST["nlId"], $email, $languageEmail, $us["code"], $userEmail);
         if (stristr($html, "</body>") === false) {
             $msg = $html . nl2br($unsubmsg);
         } else {
             $msg = str_replace("</body>", nl2br($unsubmsg) . "</body>", $html);
         }
     } else {
         $msg = $html;
     }
     $mail->setHtml($msg, $txt . strip_tags($unsubmsg));
     $mail->buildMessage();
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:31,代码来源:tiki-send_newsletters.php

示例9: sendForumEmailNotification

/** \brief send the email notifications dealing with the forum changes to
 * \brief outbound address + admin notification addresses / forum admin email + watching users addresses
 * \param $event = 'forum_post_topic' or 'forum_post_thread'
 * \param $object = forumId watch if forum_post_topic or topicId watch if forum_post_thread
 * \param $threadId = topicId if forum_post_thread
 * \param $title of the message
 * \param $topicName name of the parent topic
 */
function sendForumEmailNotification($event, $object, $forum_info, $title, $data, $author, $topicName, $messageId = '', $inReplyTo = '', $threadId, $parentId, $contributions = '', $postId = '')
{
    global $tikilib, $prefs, $smarty, $userlib;
    // Per-forum From address overrides global default.
    if ($forum_info['outbound_from']) {
        $author = $userlib->clean_user($author);
        $my_sender = '"' . "{$author}" . '" <' . $forum_info['outbound_from'] . '>';
    } else {
        $my_sender = $prefs['sender_email'];
    }
    //outbound email ->  will be sent in utf8 - from sender_email
    if ($forum_info['outbound_address']) {
        include_once 'lib/webmail/tikimaillib.php';
        $mail = new TikiMail();
        $mail->setSubject($title);
        if (!empty($forum_info['outbound_mails_reply_link']) && $forum_info['outbound_mails_reply_link'] == 'y') {
            $foo = parse_url($_SERVER["REQUEST_URI"]);
            $machine = $tikilib->httpPrefix(true) . dirname($foo["path"]);
            if ($event == 'forum_post_topic') {
                $reply_link = "{$machine}/tiki-view_forum_thread.php?forumId=" . $forum_info['forumId'] . "&comments_parentId={$threadId}#form";
            } else {
                $reply_link = "{$machine}/tiki-view_forum_thread.php?forumId=" . $forum_info['forumId'] . "&comments_reply_threadId={$object}&comments_parentId={$threadId}&post_reply=1#form";
            }
        } else {
            $reply_link = '';
        }
        $smarty->assign('title', $title);
        $smarty->assign('data', $data);
        $smarty->assign('reply_link', $reply_link);
        $smarty->assign('author', $author);
        $mail_data = $smarty->fetch("mail/forum_outbound.tpl");
        $mail->setText($mail_data);
        $mail->setReplyTo($my_sender);
        $mail->setFrom($my_sender);
        $mail->setSubject($topicName);
        if ($inReplyTo) {
            $mail->setHeader("In-Reply-To", "<" . $inReplyTo . ">");
        }
        global $commentslib;
        $attachments = $commentslib->get_thread_attachments($event == 'forum_post_topic' ? $threadId : $object, 0);
        if (count($attachments) > 0) {
            foreach ($attachments as $att) {
                $att_data = $commentslib->get_thread_attachment($att['attId']);
                if ($att_data['dir'] . $att_data['path'] == "") {
                    // no path to file on disk
                    $file = $att_data['data'];
                    // read file from database
                } else {
                    $file = $mail->getFile($att_data['dir'] . $att_data['path']);
                    // read file from disk
                }
                $mail->addAttachment($file, $att_data['filename'], $att_data['filetype']);
            }
        }
        // Message-ID is set below buildMessage because otherwise lib/webmail/htmlMimeMail.php will over-write it.
        $mail->setHeader("Message-ID", "<" . $messageId . ">");
        $mail->send(array($forum_info['outbound_address']));
    }
    $nots = array();
    $defaultLanguage = $prefs['site_language'];
    // Users watching this forum or this post
    if ($prefs['feature_user_watches'] == 'y' || $prefs['feature_group_watches'] == 'y') {
        $nots_raw = $tikilib->get_event_watches($event, $event == 'forum_post_topic' ? $forum_info['forumId'] : $threadId, $forum_info);
        $nots = array();
        $users = array();
        foreach ($nots_raw as $n) {
            if ($n['user'] != $author && !in_array($n['user'], $users)) {
                // make sure user receive only one notification even if he is monitoring both the topic and thread
                $n['language'] = $tikilib->get_user_preference($n['user'], "language", $defaultLanguage);
                $nots[] = $n;
                $users[] = $n['user'];
            }
        }
    }
    // Special forward address
    //TODO: merge or use the admin notification feature
    if ($forum_info["useMail"] == 'y') {
        $not['email'] = $forum_info['mail'];
        if ($not['user'] = $userlib->get_user_by_email($forum_info['mail'])) {
            $not['language'] = $tikilib->get_user_preference($not['user'], "language", $defaultLanguage);
        } else {
            $not['language'] = $defaultLanguage;
        }
        $nots[] = $not;
    }
    if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
        $reportsManager = Reports_Factory::build('Reports_Manager');
        $reportsManager->addToCache($nots, array("event" => $event, "forumId" => $forum_info['forumId'], "forumName" => $forum_info['name'], "topicId" => $threadId, "threadId" => $postId, "threadName" => $topicName, "user" => $author));
    }
    if (count($nots)) {
        include_once 'lib/webmail/tikimaillib.php';
        $smarty->assign('mail_forum', $forum_info["name"]);
//.........这里部分代码省略.........
开发者ID:hurcane,项目名称:tiki-azure,代码行数:101,代码来源:notificationemaillib.php

示例10: tra

 if (empty($errors)) {
     include_once 'lib/webmail/tikimaillib.php';
     $smarty->assign_by_ref('mail_site', $_SERVER['SERVER_NAME']);
     if (isset($_REQUEST['report']) && $_REQUEST['report'] == 'y') {
         $subject = tra('Report to the webmaster', $prefs['site_language']);
     } else {
         $subject = $smarty->fetch('mail/tellAFriend_subject.tpl');
     }
     // Generate once, unless token is required, in which case, regenrate per-message
     if ($prefs['auth_token_tellafriend'] != 'y' || $prefs['auth_token_access'] != 'y' || !isset($_POST['share_access'])) {
         $txt = $smarty->fetch('mail/tellAFriend.tpl');
     }
     $ok = true;
     foreach ($emails as $email) {
         $mail = new TikiMail();
         $mail->setFrom($from);
         $mail->setReplyTo($from);
         $mail->setSubject($subject);
         if ($prefs['auth_token_tellafriend'] == 'y' && $prefs['auth_token_access'] == 'y' && isset($_POST['share_access'])) {
             require_once 'lib/auth/tokens.php';
             $tokenlib = AuthTokens::build($prefs);
             $url_for_friend = $tokenlib->includeToken($url_for_friend, $globalperms->getGroups());
             $smarty->assign('url_for_friend', $url_for_friend);
             $txt = $smarty->fetch('mail/tellAFriend.tpl');
         }
         $mail->setText($txt);
         $ok = $ok && $mail->send(array($email));
     }
     if ($ok) {
         $access->redirect($_REQUEST['url'], tra('Your link was sent.'));
     } else {
开发者ID:rjsmelo,项目名称:tiki,代码行数:31,代码来源:tiki-tell_a_friend.php

示例11: wikiplugin_tracker


//.........这里部分代码省略.........
                        include_once "freetag_apply.php";
                    }
                    if ($discarditem == 'y') {
                        $trklib->remove_tracker_item($rid);
                    }
                    if (empty($url)) {
                        global $wikilib;
                        $url[0] = $wikilib->sefurl($newpagename);
                    }
                }
                // end wiki output
                if (!empty($email)) {
                    $emailOptions = preg_split("#\\|#", $email);
                    if (is_numeric($emailOptions[0])) {
                        $emailOptions[0] = $trklib->get_item_value($trackerId, $rid, $emailOptions[0]);
                    }
                    if (empty($emailOptions[0])) {
                        // from
                        $emailOptions[0] = $prefs['sender_email'];
                    }
                    if (empty($emailOptions[1])) {
                        // to
                        $emailOptions[1][0] = $prefs['sender_email'];
                    } else {
                        $emailOptions[1] = preg_split('/ *, */', $emailOptions[1]);
                        foreach ($emailOptions[1] as $key => $email) {
                            if (is_numeric($email)) {
                                $emailOptions[1][$key] = $trklib->get_item_value($trackerId, $rid, $email);
                            }
                        }
                    }
                    include_once 'lib/webmail/tikimaillib.php';
                    $mail = new TikiMail();
                    $mail->setFrom($emailOptions[0]);
                    if (!empty($emailOptions[2])) {
                        //tpl
                        $emailOptions[2] = preg_split('/ *, */', $emailOptions[2]);
                        foreach ($emailOptions[2] as $ieo => $eo) {
                            if (!preg_match('/\\.tpl$/', $eo)) {
                                $emailOptions[2][$ieo] = $eo . '.tpl';
                            }
                            $tplSubject[$ieo] = str_replace('.tpl', '_subject.tpl', $emailOptions[2][$ieo]);
                        }
                    } else {
                        $emailOptions[2] = array('tracker_changed_notification.tpl');
                    }
                    if (empty($tplSubject)) {
                        $tplSubject = array('tracker_changed_notification_subject.tpl');
                    }
                    $itpl = 0;
                    $smarty->assign('mail_date', $tikilib->now);
                    $smarty->assign('mail_itemId', $rid);
                    foreach ($emailOptions[1] as $ieo => $ueo) {
                        @($mail_data = $smarty->fetch('mail/' . $tplSubject[$itpl]));
                        if (empty($mail_data)) {
                            $mail_data = tra('Tracker was modified at ') . $_SERVER["SERVER_NAME"];
                        }
                        $mail->setSubject($mail_data);
                        $mail_data = $smarty->fetch('mail/' . $emailOptions[2][$itpl]);
                        if ($emailformat == 'html') {
                            $mail->setHtml($mail_data);
                        } else {
                            $mail->setText($mail_data);
                        }
                        $mail->send($ueo);
                        if (isset($tplSubject[$itpl + 1])) {
开发者ID:hurcane,项目名称:tiki-azure,代码行数:67,代码来源:wikiplugin_tracker.php


注:本文中的TikiMail::setFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。