getJournal(); $subscriptionContactName = $journal->getSetting('subscriptionName'); $subscriptionContactEmail = $journal->getSetting('subscriptionEmail'); if (empty($subscriptionContactEmail)) { $subscriptionContactEmail = $journal->getSetting('contactEmail'); $subscriptionContactName = $journal->getSetting('contactName'); } if (empty($subscriptionContactEmail)) return false; $userDao = DAORegistry::getDAO('UserDAO'); $user = $userDao->getById($subscription->getUserId()); $subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO'); $subscriptionType = $subscriptionTypeDao->getById($subscription->getTypeId(), $journal->getId()); $paramArray = array( 'subscriptionType' => $subscriptionType->getSummaryString(), 'userDetails' => $user->getContactSignature(), 'membership' => $subscription->getMembership() ); switch($mailTemplateKey) { case 'SUBSCRIPTION_PURCHASE_INDL': case 'SUBSCRIPTION_RENEW_INDL': $paramArray['subscriptionUrl'] = $request->url($journal->getPath(), 'payments', null, null, null, 'individual'); break; case 'SUBSCRIPTION_PURCHASE_INSTL': case 'SUBSCRIPTION_RENEW_INSTL': $paramArray['subscriptionUrl'] = $request->url($journal->getPath(), 'payments', null, null, null, 'institutional'); $paramArray['institutionName'] = $subscription->getInstitutionName(); $paramArray['institutionMailingAddress'] = $subscription->getInstitutionMailingAddress(); $paramArray['domain'] = $subscription->getDomain(); $paramArray['ipRanges'] = $subscription->getIPRangesString(); break; } import('lib.pkp.classes.mail.MailTemplate'); $mail = new MailTemplate($mailTemplateKey); $mail->setReplyTo($subscriptionContactEmail, $subscriptionContactName); $mail->addRecipient($subscriptionContactEmail, $subscriptionContactName); $mail->setSubject($mail->getSubject($journal->getPrimaryLocale())); $mail->setBody($mail->getBody($journal->getPrimaryLocale())); $mail->assignParams($paramArray); $mail->send(); } } ?>