本文整理汇总了PHP中MailTemplate::send方法的典型用法代码示例。如果您正苦于以下问题:PHP MailTemplate::send方法的具体用法?PHP MailTemplate::send怎么用?PHP MailTemplate::send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailTemplate
的用法示例。
在下文中一共展示了MailTemplate::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendReminder
function sendReminder($subscription, $journal, $emailKey)
{
$userDao = DAORegistry::getDAO('UserDAO');
$subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
$journalName = $journal->getLocalizedName();
$user = $userDao->getById($subscription->getUserId());
if (!isset($user)) {
return false;
}
$subscriptionType = $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId());
$subscriptionName = $journal->getSetting('subscriptionName');
$subscriptionEmail = $journal->getSetting('subscriptionEmail');
$subscriptionPhone = $journal->getSetting('subscriptionPhone');
$subscriptionMailingAddress = $journal->getSetting('subscriptionMailingAddress');
$subscriptionContactSignature = $subscriptionName;
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_APP_COMMON);
if ($subscriptionMailingAddress != '') {
$subscriptionContactSignature .= "\n" . $subscriptionMailingAddress;
}
if ($subscriptionPhone != '') {
$subscriptionContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $subscriptionPhone;
}
$subscriptionContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $subscriptionEmail;
$paramArray = array('subscriberName' => $user->getFullName(), 'journalName' => $journalName, 'subscriptionType' => $subscriptionType->getSummaryString(), 'expiryDate' => $subscription->getDateEnd(), 'username' => $user->getUsername(), 'subscriptionContactSignature' => $subscriptionContactSignature);
import('lib.pkp.classes.mail.MailTemplate');
$mail = new MailTemplate($emailKey, $journal->getPrimaryLocale(), $journal, false);
$mail->setReplyTo($subscriptionEmail, $subscriptionName);
$mail->addRecipient($user->getEmail(), $user->getFullName());
$mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
$mail->setBody($mail->getBody($journal->getPrimaryLocale()));
$mail->assignParams($paramArray);
$mail->send();
}
示例2: sendNotification
function sendNotification($users, $journal, $issue)
{
if ($users->getCount() != 0) {
import('lib.pkp.classes.mail.MailTemplate');
$email = new MailTemplate('OPEN_ACCESS_NOTIFY', $journal->getPrimaryLocale());
$email->setSubject($email->getSubject($journal->getPrimaryLocale()));
$email->setReplyTo(null);
$email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$paramArray = array('journalName' => $journal->getLocalizedName(), 'journalUrl' => Request::url($journal->getPath()), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getLocalizedName());
$email->assignParams($paramArray);
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticles = $publishedArticleDao->getPublishedArticlesInSections($issue->getId());
$mimeBoundary = '==boundary_' . md5(microtime());
$templateMgr = TemplateManager::getManager();
$templateMgr->assign('body', $email->getBody($journal->getPrimaryLocale()));
$templateMgr->assign('templateSignature', $journal->getSetting('emailSignature'));
$templateMgr->assign('mimeBoundary', $mimeBoundary);
$templateMgr->assign('issue', $issue);
$templateMgr->assign('publishedArticles', $publishedArticles);
$email->addHeader('MIME-Version', '1.0');
$email->setContentType('multipart/alternative; boundary="' . $mimeBoundary . '"');
$email->setBody($templateMgr->fetch('subscription/openAccessNotifyEmail.tpl'));
while ($user = $users->next()) {
$email->addBcc($user->getEmail(), $user->getFullName());
}
$email->send();
}
}
示例3: send
/**
* @see parent::send()
* @param $request PKPRequest optional (used for logging purposes)
*/
function send($request = null)
{
if (parent::send(false)) {
$this->log($request);
return true;
} else {
return false;
}
}
示例4: send
/**
* @see parent::send()
*/
function send()
{
if (parent::send()) {
if (!isset($this->skip) || !$this->skip) {
$this->log();
}
return true;
} else {
return false;
}
}
示例5: sendReminder
/**
* Send email to a book for review author
*/
function sendReminder($book, $journal, $emailKey)
{
$journalId = $journal->getId();
$paramArray = array('authorName' => strip_tags($book->getUserFullName()), 'bookForReviewTitle' => '"' . strip_tags($book->getLocalizedTitle()) . '"', 'bookForReviewDueDate' => date('l, F j, Y', strtotime($book->getDateDue())), 'submissionUrl' => Request::url(null, 'author', 'submit'), 'editorialContactSignature' => strip_tags($book->getEditorContactSignature()));
import('classes.mail.MailTemplate');
$mail = new MailTemplate($emailKey);
$mail->setReplyTo($book->getEditorEmail(), $book->getEditorFullName());
$mail->addRecipient($book->getUserEmail(), $book->getUserFullName());
$mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
$mail->setBody($mail->getBody($journal->getPrimaryLocale()));
$mail->assignParams($paramArray);
$mail->send();
}
示例6: execute
/**
* Send the email
* @param $args array
* @param $request PKPRequest
*/
function execute($args, $request)
{
$userDao = DAORegistry::getDAO('UserDAO');
$toUser = $userDao->getById($this->userId);
$fromUser = $request->getUser();
import('lib.pkp.classes.mail.MailTemplate');
$email = new MailTemplate();
$email->addRecipient($toUser->getEmail(), $toUser->getFullName());
$email->setReplyTo($fromUser->getEmail(), $fromUser->getFullName());
$email->setSubject($this->getData('subject'));
$email->setBody($this->getData('message'));
$email->send();
}
示例7: send
/**
* @see parent::send()
*/
function send()
{
if (parent::send(false)) {
if (!isset($this->skip) || !$this->skip) {
$this->log();
}
$user =& Request::getUser();
if ($this->attachmentsEnabled) {
$this->_clearAttachments($user->getId());
}
return true;
} else {
return false;
}
}
示例8: send
/**
* @see parent::send()
*/
function send($request = null)
{
if (parent::send(false)) {
if (!isset($this->skip) || !$this->skip) {
$this->log($request);
}
if ($request) {
$user =& $request->getUser();
if ($user && $this->attachmentsEnabled) {
$this->_clearAttachments($user->getId());
}
}
return true;
} else {
return false;
}
}
示例9: sendReminder
/**
* Send email to object for review author
* @param $ofrAssignment ObjectForReviewAssignment
* @param $journal Journal
* @param $emailKey string
*/
function sendReminder($ofrAssignment, $journal, $emailKey)
{
$journalId = $journal->getId();
$author =& $ofrAssignment->getUser();
$objectForReview =& $ofrAssignment->getObjectForReview();
$editor =& $objectForReview->getEditor();
$paramArray = array('authorName' => strip_tags($author->getFullName()), 'objectForReviewTitle' => '"' . strip_tags($objectForReview->getTitle()) . '"', 'objectForReviewDueDate' => date('l, F j, Y', strtotime($ofrAssignment->getDateDue())), 'submissionUrl' => Request::url($journal->getPath(), 'author', 'submit'), 'editorialContactSignature' => strip_tags($editor->getContactSignature()));
import('classes.mail.MailTemplate');
$mail = new MailTemplate($emailKey);
$mail->setReplyTo($editor->getEmail(), $editor->getFullName());
$mail->addRecipient($author->getEmail(), $author->getFullName());
$mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
$mail->setBody($mail->getBody($journal->getPrimaryLocale()));
$mail->assignParams($paramArray);
$mail->send();
$ofrAssignment->setDateReminded(Core::getCurrentDate());
$ofrAssignmentDao =& DAORegistry::getDAO('ObjectForReviewAssignmentDAO');
$ofrAssignmentDao->updateObject($ofrAssignment);
}
示例10: email
/**
* Send an email to a user or group of users.
*/
function email($args)
{
$this->validate();
$this->setupTemplate(true);
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('helpTopicId', 'conference.users.emailUsers');
$userDao =& DAORegistry::getDAO('UserDAO');
$site =& Request::getSite();
$user =& Request::getUser();
import('classes.mail.MailTemplate');
$email = new MailTemplate(Request::getUserVar('template'), Request::getUserVar('locale'));
if (Request::getUserVar('send') && !$email->hasErrors()) {
$email->send();
Request::redirect(null, null, Request::getRequestedPage());
} else {
$email->assignParams();
// FIXME Forces default parameters to be assigned (should do this automatically in MailTemplate?)
if (!Request::getUserVar('continued')) {
if (($groupId = Request::getUserVar('toGroup')) != '') {
// Special case for emailing entire groups:
// Check for a group ID and add recipients.
$groupDao =& DAORegistry::getDAO('GroupDAO');
$group =& $groupDao->getGroup($groupId, ASSOC_TYPE_SCHED_CONF, $schedConf->getId());
if ($group) {
$groupMembershipDao =& DAORegistry::getDAO('GroupMembershipDAO');
$memberships =& $groupMembershipDao->getMemberships($group->getId());
$memberships =& $memberships->toArray();
foreach ($memberships as $membership) {
$user =& $membership->getUser();
$email->addRecipient($user->getEmail(), $user->getFullName());
}
}
}
if (count($email->getRecipients()) == 0) {
$email->addRecipient($user->getEmail(), $user->getFullName());
}
}
$email->displayEditForm(Request::url(null, null, null, 'email'), array(), 'manager/people/email.tpl');
}
}
示例11: send
/**
* Send the email.
* @return boolean
*/
function send()
{
@set_time_limit(0);
$realRecipients = $this->getRecipients();
$realSubject = $this->getSubject();
$realBody = $this->getBody();
$index = 0;
$success = true;
$max = count($realRecipients);
foreach ($realRecipients as $recipient) {
$this->clearAllRecipients();
$this->addRecipient($recipient['email'], $recipient['name']);
$this->setSubject($realSubject);
$this->setBody($realBody);
$success = $success && MailTemplate::send(false);
$index++;
if ($this->callback && $index % $this->frequency == 0) {
call_user_func($this->callback, $index, $max);
}
}
$this->setRecipients($realRecipients);
return $success;
}
示例12: sendReminder
function sendReminder($registration, $conference, $schedConf, $emailKey)
{
$userDao =& DAORegistry::getDAO('UserDAO');
$registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
$schedConfName = $schedConf->getSchedConfTitle();
$schedConfId = $schedConf->getId();
$user =& $userDao->getUser($registration->getUserId());
if (!isset($user)) {
return false;
}
$registrationType =& $registrationTypeDao->getRegistrationType($registration->getTypeId());
$registrationName = $schedConf->getSetting('registrationName');
$registrationEmail = $schedConf->getSetting('registrationEmail');
$registrationPhone = $schedConf->getSetting('registrationPhone');
$registrationFax = $schedConf->getSetting('registrationFax');
$registrationMailingAddress = $schedConf->getSetting('registrationMailingAddress');
$registrationContactSignature = $registrationName;
if ($registrationMailingAddress != '') {
$registrationContactSignature .= "\n" . $registrationMailingAddress;
}
if ($registrationPhone != '') {
$registrationContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $registrationPhone;
}
if ($registrationFax != '') {
$registrationContactSignature .= "\n" . AppLocale::Translate('user.fax') . ': ' . $registrationFax;
}
$registrationContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $registrationEmail;
$paramArray = array('registrantName' => $user->getFullName(), 'conferenceName' => $conferenceName, 'schedConfName' => $schedConfName, 'registrationType' => $registrationType->getSummaryString(), 'expiryDate' => $registration->getDateEnd(), 'username' => $user->getUsername(), 'registrationContactSignature' => $registrationContactSignature);
import('mail.MailTemplate');
$mail = new MailTemplate($emailKey, $conference->getPrimaryLocale());
$mail->setFrom($registrationEmail, $registrationName);
$mail->addRecipient($user->getEmail(), $user->getFullName());
$mail->setSubject($mail->getSubject($conference->getPrimaryLocale()));
$mail->setBody($mail->getBody($conference->getPrimaryLocale()));
$mail->assignParams($paramArray);
$mail->send();
}
示例13: execute
/**
* Register a new user.
* @return $userId int
*/
function execute()
{
$userDao =& DAORegistry::getDAO('UserDAO');
$user = new User();
$user->setSalutation($this->getData('salutation'));
$user->setFirstName($this->getData('firstName'));
$user->setMiddleName($this->getData('middleName'));
$user->setLastName($this->getData('lastName'));
$user->setGender($this->getData('gender'));
$user->setInitials($this->getData('initials'));
$user->setAffiliation($this->getData('affiliation'));
$user->setEmail($this->getData('email'));
$user->setUrl($this->getData('userUrl'));
$user->setPhone($this->getData('phone'));
$user->setFax($this->getData('fax'));
$user->setMailingAddress($this->getData('mailingAddress'));
$user->setCountry($this->getData('country'));
$user->setBiography($this->getData('biography'), null);
// Localized
$user->setInterests($this->getData('interests'), null);
// Localized
$user->setGossip($this->getData('gossip'), null);
// Localized
$user->setMustChangePassword($this->getData('mustChangePassword') ? 1 : 0);
$authDao =& DAORegistry::getDAO('AuthSourceDAO');
$auth =& $authDao->getDefaultPlugin();
$user->setAuthId($auth ? $auth->getAuthId() : 0);
$site =& Request::getSite();
$availableLocales = $site->getSupportedLocales();
$locales = array();
foreach ($this->getData('userLocales') as $locale) {
if (AppLocale::isLocaleValid($locale) && in_array($locale, $availableLocales)) {
array_push($locales, $locale);
}
}
$user->setLocales($locales);
$user->setUsername($this->getData('username'));
$password = Validation::generatePassword();
$sendNotify = $this->getData('sendNotify');
if (isset($auth)) {
$user->setPassword($password);
// FIXME Check result and handle failures
$auth->doCreateUser($user);
$user->setAuthId($auth->authId);
$user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword()));
// Used for PW reset hash only
} else {
$user->setPassword(Validation::encryptCredentials($this->getData('username'), $password));
}
$user->setDateRegistered(Core::getCurrentDate());
$userId = $userDao->insertUser($user);
$roleDao =& DAORegistry::getDAO('RoleDAO');
$schedConf =& Request::getSchedConf();
$role = new Role();
$role->setConferenceId($schedConf->getConferenceId());
$role->setSchedConfId($schedConf->getId());
$role->setUserId($userId);
$role->setRoleId(ROLE_ID_REVIEWER);
$roleDao->insertRole($role);
if ($sendNotify) {
// Send welcome email to user
import('mail.MailTemplate');
$mail = new MailTemplate('USER_REGISTER');
$mail->setFrom($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
$mail->assignParams(array('username' => $this->getData('username'), 'password' => $password));
$mail->addRecipient($user->getEmail(), $user->getFullName());
$mail->send();
}
return $userId;
}
示例14: sendToMailingList
/**
* Send an update to all users on the mailing list
* @param $notification object Notification
*/
function sendToMailingList($notification)
{
$notificationSettingsDao =& DAORegistry::getDAO('NotificationSettingsDAO');
$mailList = $notificationSettingsDao->getMailList();
Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON));
foreach ($mailList as $email) {
if ($notification->getIsLocalized()) {
$params = array('param' => $notification->getParam());
$notificationContents = Locale::translate($notification->getContents(), $params);
} else {
$notificationContents = $notification->getContents();
}
import('mail.MailTemplate');
$context =& Request::getContext();
$site =& Request::getSite();
$mail = new MailTemplate('NOTIFICATION_MAILLIST');
$mail->setFrom($site->getLocalizedContactEmail(), $site->getLocalizedContactName());
$mail->assignParams(array('notificationContents' => $notificationContents, 'url' => $notification->getLocation(), 'siteTitle' => $context->getLocalizedTitle(), 'unsubscribeLink' => Request::url(null, 'notification', 'unsubscribeMailList')));
$mail->addRecipient($email);
$mail->send();
}
}
示例15: emailAuthor
/**
* Display the "email author"
* @param $args array
* @param $request Request
*/
function emailAuthor($args, &$request)
{
$router =& $request->getRouter();
$this->setupTemplate();
$paperId = isset($args[0]) ? $args[0] : 0;
$galleyId = isset($args[1]) ? (int) $args[1] : 0;
$this->validate($request, $paperId, $galleyId);
$conference =& $router->getContext($request, CONTEXT_CONFERENCE);
$schedConf =& $router->getContext($request, CONTEXT_SCHED_CONF);
$paper =& $this->paper;
$rtDao =& DAORegistry::getDAO('RTDAO');
$conferenceRt =& $rtDao->getConferenceRTByConference($conference);
$user =& $request->getUser();
if (!$conferenceRt || !$conferenceRt->getEmailAuthor() || !$user) {
$request->redirect(null, null, $router->getRequestedPage($request));
}
import('mail.MailTemplate');
$email = new MailTemplate();
if ($request->getUserVar('send') && !$email->hasErrors()) {
$email->send();
$templateMgr =& TemplateManager::getManager();
$templateMgr->display('rt/sent.tpl');
} else {
if (!$request->getUserVar('continued')) {
$email->setSubject('[' . $schedConf->getLocalizedSetting('acronym') . '] ' . strip_tags($paper->getLocalizedTitle()));
$authors =& $paper->getAuthors();
$author =& $authors[0];
$email->addRecipient($author->getEmail(), $author->getFullName());
}
$email->displayEditForm($router->url($request, null, null, null, 'emailAuthor', array($paperId, $galleyId)), null, 'rt/email.tpl', array('op' => 'emailAuthor'));
}
}