本文整理匯總了PHP中OW::getMailer方法的典型用法代碼示例。如果您正苦於以下問題:PHP OW::getMailer方法的具體用法?PHP OW::getMailer怎麽用?PHP OW::getMailer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OW
的用法示例。
在下文中一共展示了OW::getMailer方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendWinkEmailNotification
public function sendWinkEmailNotification($userId, $partnerId, $winkType)
{
if (empty($userId) || empty($partnerId) || ($user = BOL_UserService::getInstance()->findUserById($userId)) === null || ($partner = BOL_UserService::getInstance()->findUserById($partnerId)) === null) {
return false;
}
$avatar = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId, $partnerId), true, true, true, false);
switch ($winkType) {
case self::EMAIL_SEND:
$subjectKey = 'wink_send_email_subject';
$subjectArr = array('displayname' => $avatar[$userId]['title']);
$textContentKey = 'wink_send_email_text_content';
$htmlContentKey = 'wink_send_email_html_content';
$contentArr = array('src' => $avatar[$userId]['src'], 'displayname' => $avatar[$userId]['title'], 'url' => $avatar[$userId]['url'], 'home_url' => OW_URL_HOME);
break;
case self::EMAIL_BACK:
default:
$subjectKey = 'wink_back_email_subject';
$subjectArr = array('displayname' => $avatar[$userId]['title']);
$textContentKey = 'wink_back_email_text_content';
$htmlContentKey = 'wink_back_email_html_content';
$contentArr = array('src' => $avatar[$userId]['src'], 'displayname' => $avatar[$userId]['title'], 'url' => $avatar[$userId]['url'], 'conversation_url' => OW::getRouter()->urlForRoute('mailbox_messages_default'));
break;
}
$language = OW::getLanguage();
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail($partner->email);
$mail->setSubject($language->text('winks', $subjectKey, $subjectArr));
$mail->setTextContent($language->text('winks', $textContentKey, $contentArr));
$mail->setHtmlContent($language->text('winks', $htmlContentKey, $contentArr));
OW::getMailer()->send($mail);
}
示例2: sendNotification
public function sendNotification()
{
if (empty($this->user)) {
return;
}
$content = $this->getHtml();
$mail = OW::getMailer()->createMail()->addRecipientEmail($this->user->email)->setSubject(OW::getLanguage()->text('bookmarks', 'email_notify_subject'))->setHtmlContent($content)->setTextContent($content);
OW::getMailer()->send($mail);
}
示例3: transferCredits
public function transferCredits($userId, $receiveUser, $creditValue)
{
$debitValue = $creditValue * -1;
$userCreditsService = USERCREDITS_BOL_CreditsService::getInstance();
$creditsService = CREDITS_BOL_Service::getInstance();
$sendItem = $this->logAction($creditsService->getSentActionId(), $userId, $debitValue);
$receiveItem = $this->logAction($creditsService->getReceiveActionId(), $receiveUser, $creditValue);
$userCreditsService->increaseBalance($receiveUser, $creditValue);
$userCreditsService->decreaseBalance($userId, $creditValue);
$sqlInsert = "INSERT INTO " . OW_DB_PREFIX . "credits_sent_log(senderItem, receiverItem, sender, receiver) \n VALUES(:sendItem, :receiveItem, :userId, :receiveUser)";
$qParams = array('sendItem' => $sendItem, 'receiveItem' => $receiveItem, 'userId' => $userId, 'receiveUser' => $receiveUser);
OW::getDbo()->query($sqlInsert, $qParams);
$service = BOL_UserService::getInstance();
$avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId, $receiveUser));
$names = $service->getDisplayNamesForList(array($userId, $receiveUser));
$uUrls = $service->getUserUrlsForList(array($userId, $receiveUser));
if (OW::getConfig()->getValue('credits', 'enableNotification') == '1') {
//Send notification to receiver
$avatar = $avatars[$userId];
$notificationParams = array('pluginKey' => 'credits', 'action' => 'credits-received', 'entityType' => 'received', 'entityId' => $receiveItem, 'userId' => $receiveUser, 'time' => time());
$sender = '<a href="' . $uUrls[$userId] . '" target="_blank" >' . $names[$userId] . '</a>';
$notificationData = array('string' => array('key' => 'credits+notify_credits_received', 'vars' => array('sender' => $sender, 'credits' => $creditValue)), 'avatar' => $avatar, 'url' => $uUrls[$userId]);
$event = new OW_Event('notifications.add', $notificationParams, $notificationData);
OW::getEventManager()->trigger($event);
}
$subject = OW::getLanguage()->text('credits', 'credits_email_subject', array('requester_name' => $names[$userId], 'credits' => $creditValue));
$content = OW::getLanguage()->text('credits', 'credits_email_content', array('requester_name' => $names[$userId], 'requester_url' => $uUrls[$userId], 'credits' => $creditValue, 'user_url' => $uUrls[$receiveUser], 'name' => $names[$receiveUser]));
if (OW::getConfig()->getValue('credits', 'enableEmail') == '1') {
$tmpUser = $service->findUserById($receiveUser);
$sitemail = OW::getConfig()->getValue('base', 'site_email');
$sitename = OW::getConfig()->getValue('base', 'site_name');
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail($tmpUser->getEmail());
$mail->setSender($sitemail, $sitename);
$mail->setSenderSuffix(true);
$mail->setSubject($subject);
$mail->setHtmlContent($content);
$mail->setTextContent(UTIL_HtmlTag::stripTags($content));
OW::getMailer()->addToQueue($mail);
}
if (OW::getConfig()->getValue('credits', 'enablePM') == '1') {
$conversation = MAILBOX_BOL_ConversationService::getInstance()->createConversation($userId, $receiveUser, $subject, $content);
}
return true;
}
示例4: sendMessage
public function sendMessage()
{
$userId = !empty($_POST['userId']) ? $_POST['userId'] : null;
$subject = !empty($_POST['subject']) ? $_POST['subject'] : null;
$message = !empty($_POST['message']) ? $_POST['message'] : null;
$user = BOL_UserService::getInstance()->findUserById($userId);
if (empty($user)) {
exit(json_encode(array('result' => false, 'message' => OW::getLanguage()->text('base', 'invalid_user'))));
}
if (empty($subject)) {
exit(json_encode(array('result' => false, 'message' => OW::getLanguage()->text('base', 'empty_subject'))));
}
if (empty($message)) {
exit(json_encode(array('result' => false, 'message' => OW::getLanguage()->text('base', 'empty_message'))));
}
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail($user->getEmail());
$mail->setSubject($subject);
$mail->setHtmlContent($message);
OW::getMailer()->send($mail);
exit(json_encode(array('result' => true, 'message' => OW::getLanguage()->text('base', 'message_send'))));
}
示例5: send
public function send()
{
if (empty($_POST['emailList'])) {
exit(json_encode(array('success' => false, 'message' => OW::getLanguage()->text('contactimporter', 'email_send_error_empty_email_list'))));
}
if (count($_POST['emailList']) > (int) OW::getConfig()->getValue('base', 'user_invites_limit')) {
exit(json_encode(array('success' => false, 'message' => OW::getLanguage()->text('contactimporter', 'email_send_error_max_limit_message', array('limit' => (int) OW::getConfig()->getValue('base', 'user_invites_limit'))))));
}
$userId = OW::getUser()->getId();
$displayName = BOL_UserService::getInstance()->getDisplayName($userId);
$vars = array('inviter' => $displayName, 'siteName' => OW::getConfig()->getValue('base', 'site_name'), 'customMessage' => empty($_POST['text']) ? null : trim($_POST['text']));
foreach ($_POST['emailList'] as $email) {
$code = UTIL_String::generatePassword(20);
BOL_UserService::getInstance()->saveUserInvitation($userId, $code);
$vars['siteInviteURL'] = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('base_join'), array('code' => $code));
$mail = OW::getMailer()->createMail();
$mail->setSubject(OW::getLanguage()->text('contactimporter', 'mail_email_invite_subject', $vars));
$mail->setHtmlContent(OW::getLanguage()->text('contactimporter', 'mail_email_invite_' . (empty($_POST['text']) ? '' : 'msg_') . 'html', $vars));
$mail->setTextContent(OW::getLanguage()->text('contactimporter', 'mail_email_invite_' . (empty($_POST['text']) ? '' : 'msg_') . 'txt', $vars));
$mail->addRecipientEmail($email);
OW::getMailer()->addToQueue($mail);
}
exit(json_encode(array('success' => true, 'message' => OW::getLanguage()->text('contactimporter', 'email_send_success', array('count' => count($_POST['emailList']))))));
}
示例6: notifyAdminAboutInvalidItems
private function notifyAdminAboutInvalidItems(array $items)
{
if (empty($items)) {
return;
}
$titleList = array();
foreach ($items as $item) {
$titleList[] = "\"{$item["title"]}\"";
}
$params = array("itemList" => implode("<br />", $titleList), "siteURL" => OW::getRouter()->getBaseUrl(), "adminUrl" => OW::getRouter()->urlForRoute("admin_plugins_installed"));
$language = OW::getLanguage();
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail(OW::getConfig()->getValue("base", "site_email"));
$mail->setSubject($language->text("admin", "mail_template_admin_invalid_license_subject"));
$mail->setHtmlContent($language->text("admin", "mail_template_admin_invalid_license_content_html", $params));
$params["itemList"] = implode(PHP_EOL, $titleList);
$mail->setTextContent($language->text("admin", "mail_template_admin_invalid_license_content_text", $params));
OW::getMailer()->send($mail);
}
示例7: sendProcess
private function sendProcess($userId, NOTIFICATIONS_CMP_Notification $cmp)
{
$userService = BOL_UserService::getInstance();
$user = $userService->findUserById($userId);
if (empty($user)) {
return false;
}
$email = $user->email;
$unsubscribeCode = $this->generateUnsubscribeCode($user);
$cmp->setUnsubscribeCode($unsubscribeCode);
$txt = $cmp->getTxt();
$html = $cmp->getHtml();
$subject = $cmp->getSubject();
try {
$mail = OW::getMailer()->createMail()->addRecipientEmail($email)->setTextContent($txt)->setHtmlContent($html)->setSubject($subject);
OW::getMailer()->send($mail);
} catch (Exception $e) {
//Skip invalid notification
}
}
示例8: index
public function index()
{
$this->setPageTitle(OW::getLanguage()->text('contactus', 'index_page_title'));
$this->setPageHeading(OW::getLanguage()->text('contactus', 'index_page_heading'));
$contactEmails = array();
$contacts = CONTACTUS_BOL_Service::getInstance()->getDepartmentList();
foreach ($contacts as $contact) {
/* @var $contact CONTACTUS_BOL_Department */
$contactEmails[$contact->id]['label'] = CONTACTUS_BOL_Service::getInstance()->getDepartmentLabel($contact->id);
$contactEmails[$contact->id]['email'] = $contact->email;
}
$form = new Form('contact_form');
$fieldTo = new Selectbox('to');
foreach ($contactEmails as $id => $value) {
$fieldTo->addOption($id, $value['label']);
}
$fieldTo->setRequired();
$fieldTo->setHasInvitation(false);
$fieldTo->setLabel($this->text('contactus', 'form_label_to'));
$form->addElement($fieldTo);
$fieldFrom = new TextField('from');
$fieldFrom->setLabel($this->text('contactus', 'form_label_from'));
$fieldFrom->setRequired();
$fieldFrom->addValidator(new EmailValidator());
if (ow::getUser()->isAuthenticated()) {
$fieldFrom->setValue(OW::getUser()->getEmail());
}
$form->addElement($fieldFrom);
$fieldSubject = new TextField('subject');
$fieldSubject->setLabel($this->text('contactus', 'form_label_subject'));
$fieldSubject->setRequired();
$form->addElement($fieldSubject);
$fieldMessage = new Textarea('message');
$fieldMessage->setLabel($this->text('contactus', 'form_label_message'));
$fieldMessage->setRequired();
$form->addElement($fieldMessage);
$fieldCaptcha = new CaptchaField('captcha');
$fieldCaptcha->setLabel($this->text('contactus', 'form_label_captcha'));
$form->addElement($fieldCaptcha);
$submit = new Submit('send');
$submit->setValue($this->text('contactus', 'form_label_submit'));
$form->addElement($submit);
$this->addForm($form);
if (OW::getRequest()->isPost()) {
if ($form->isValid($_POST)) {
$data = $form->getValues();
if (!array_key_exists($data['to'], $contactEmails)) {
OW::getFeedback()->error($this->text('contactus', 'no_department'));
return;
}
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail($contactEmails[$data['to']]['email']);
$mail->setSender($data['from']);
$mail->setSenderSuffix(false);
$mail->setSubject($data['subject']);
$mail->setTextContent($data['message']);
OW::getMailer()->addToQueue($mail);
OW::getSession()->set('contactus.dept', $contactEmails[$data['to']]['label']);
$this->redirectToAction('sent');
}
}
}
示例9: sendNotification
public function sendNotification()
{
$subject = $this->getSubject();
$txt = $this->getTxt();
$html = $this->getHtml();
$mail = OW::getMailer()->createMail()->addRecipientEmail($this->user->email)->setTextContent($txt)->setHtmlContent($html)->setSubject($subject);
OW::getMailer()->send($mail);
// BOL_PreferenceService::getInstance()->savePreferenceValue('matchmaking_lastmatch_userid', (int)$this->items[0]['id'], $this->user->getId());
BOL_PreferenceService::getInstance()->savePreferenceValue('matchmaking_lastmatch_userid', (int) $this->lastUserId, $this->user->getId());
}
示例10: send
public function send()
{
$request = json_decode($_POST['request'], true);
$userId = OW::getUser()->getId();
$displayName = BOL_UserService::getInstance()->getDisplayName($userId);
foreach ($request['contacts'] as $email) {
$code = UTIL_String::getRandomString(20);
BOL_UserService::getInstance()->saveUserInvitation($userId, $code);
$inviteUrl = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('base_join'), array('code' => $code));
$assigns = array('url' => $inviteUrl, 'message' => empty($request['message']) ? '' : $request['message'], 'user' => $displayName);
$tpl = empty($request['message']) ? 'mail_google_invite' : 'mail_google_invite_msg';
$mail = OW::getMailer()->createMail();
$mail->setSubject(OW::getLanguage()->text('contactimporter', 'mail_google_invite_subject', $assigns));
$mail->setHtmlContent(OW::getLanguage()->text('contactimporter', $tpl . '_html', $assigns));
$mail->setTextContent(OW::getLanguage()->text('contactimporter', $tpl . '_txt', $assigns));
$mail->addRecipientEmail($email);
OW::getMailer()->addToQueue($mail);
}
$message = OW::getLanguage()->text('contactimporter', 'google_send_success', array('count' => count($request['contacts'])));
exit($message);
}
示例11: process
/**
* Updates user settings configuration
*
* @return boolean
*/
public function process()
{
$values = $this->getValues();
$config = OW::getConfig();
$config->saveConfig('base', 'avatar_size', $values['avatarSize']);
$config->saveConfig('base', 'avatar_big_size', $values['bigAvatarSize']);
$config->saveConfig('base', 'display_name_question', $values['displayName']);
$config->saveConfig('base', 'join_display_photo_upload', $values['join_display_photo_upload']);
$config->saveConfig('base', 'join_display_terms_of_use', $values['join_display_terms_of_use']);
$config->saveConfig('base', 'avatar_max_upload_size', round((double) $values['avatar_max_upload_size'], 2));
if (!defined('OW_PLUGIN_XP')) {
$config->saveConfig('base', 'confirm_email', $values['confirmEmail']);
}
$avatarService = BOL_AvatarService::getInstance();
if (isset($_FILES['avatar']['tmp_name'])) {
$avatarService->setCustomDefaultAvatar(1, $_FILES['avatar']);
}
if (isset($_FILES['bigAvatar']['tmp_name'])) {
$avatarService->setCustomDefaultAvatar(2, $_FILES['bigAvatar']);
}
// privacy
$config->saveConfig('base', 'who_can_join', (int) $values['who_can_join']);
$config->saveConfig('base', 'who_can_invite', (int) $values['who_can_invite']);
$config->saveConfig('base', 'mandatory_user_approve', (bool) $values['user_approve'] ? 1 : 0);
if ((int) $values['guests_can_view'] == 3) {
$adminEmail = OW::getUser()->getEmail();
$senderMail = $config->getValue('base', 'site_email');
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail($adminEmail);
$mail->setSender($senderMail);
$mail->setSenderSuffix(false);
$mail->setSubject(OW::getLanguage()->text('admin', 'site_password_letter_subject', array()));
$mail->setTextContent(OW::getLanguage()->text('admin', 'site_password_letter_template_text', array('password' => $values['password'])));
$mail->setHtmlContent(OW::getLanguage()->text('admin', 'site_password_letter_template_html', array('password' => $values['password'])));
try {
OW::getMailer()->send($mail);
} catch (Exception $e) {
$logger = OW::getLogger('admin.send_password_message');
$logger->addEntry($e->getMessage());
$logger->writeLog();
}
$values['password'] = crypt($values['password'], OW_PASSWORD_SALT);
$config->saveConfig('base', 'guests_can_view_password', $values['password']);
} else {
$config->saveConfig('base', 'guests_can_view_password', null);
}
$config->saveConfig('base', 'guests_can_view', (int) $values['guests_can_view']);
// profile questions
isset($_POST['user_view_presentation']) ? $config->saveConfig('base', 'user_view_presentation', 'tabs') : $config->saveConfig('base', 'user_view_presentation', 'table');
return array('result' => true);
}
示例12: index
public function index($params = array())
{
$userService = BOL_UserService::getInstance();
$language = OW::getLanguage();
$this->setPageHeading($language->text('admin', 'massmailing'));
$this->setPageHeadingIconClass('ow_ic_script');
$massMailingForm = new Form('massMailingForm');
$massMailingForm->setId('massMailingForm');
$rolesList = BOL_AuthorizationService::getInstance()->getRoleList();
$userRoles = new CheckboxGroup('userRoles');
$userRoles->setLabel($language->text('admin', 'massmailing_user_roles_label'));
foreach ($rolesList as $role) {
if ($role->name != 'guest') {
$userRoles->addOption($role->name, $language->text('base', 'authorization_role_' . $role->name));
}
}
$massMailingForm->addElement($userRoles);
$emailFormat = new Selectbox('emailFormat');
$emailFormat->setLabel($language->text('admin', 'massmailing_email_format_label'));
$emailFormat->setOptions(array(self::EMAIL_FORMAT_TEXT => $language->text('admin', 'massmailing_email_format_text'), self::EMAIL_FORMAT_HTML => $language->text('admin', 'massmailing_email_format_html')));
$emailFormat->setValue(self::EMAIL_FORMAT_TEXT);
$emailFormat->setHasInvitation(false);
if (!empty($_POST['emailFormat'])) {
$emailFormat->setValue($_POST['emailFormat']);
}
$massMailingForm->addElement($emailFormat);
$subject = new TextField('subject');
$subject->addAttribute('class', 'ow_text');
$subject->addAttribute('style', 'width: auto;');
$subject->setRequired();
$subject->setLabel($language->text('admin', 'massmailing_subject_label'));
if (!empty($_POST['subject'])) {
$subject->setValue($_POST['subject']);
}
$massMailingForm->addElement($subject);
$body = new Textarea('body');
if ($emailFormat->getValue() == self::EMAIL_FORMAT_HTML) {
$body = new WysiwygTextarea('body');
$body->forceAddButtons(array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_HTML));
}
$body->addAttribute('class', 'ow_text');
$body->addAttribute('style', 'width: auto;');
$body->setRequired();
$body->setLabel($language->text('admin', 'massmailing_body_label'));
if (!empty($_POST['body'])) {
$body->setValue($_POST['body']);
}
$massMailingForm->addElement($body);
$submit = new Submit('startMailing');
$submit->addAttribute('class', 'ow_button');
$submit->setValue($language->text('admin', 'massmailing_start_mailing_button'));
$massMailingForm->addElement($submit);
$this->addForm($massMailingForm);
$ignoreUnsubscribe = false;
$isActive = true;
if (defined('OW_PLUGIN_XP')) {
$massMailingTimestamp = OW::getConfig()->getValue('admin', 'mass_mailing_timestamp');
$timeout = $massMailingTimestamp + 60 * 60 * 24 - time();
if ($timeout > 0) {
$isActive = false;
$this->assign('expireText', $language->text('admin', 'massmailing_expire_text', array('hours' => (int) ceil($timeout / (60 * 60)))));
}
}
$this->assign('isActive', $isActive);
$total = $userService->findMassMailingUserCount($ignoreUnsubscribe);
if (OW::getRequest()->isPost() && $isActive && isset($_POST['startMailing'])) {
if ($massMailingForm->isValid($_POST)) {
$data = $massMailingForm->getValues();
$start = 0;
$count = self::MAILS_ARRAY_MAX_RECORDS;
$mailCount = 0;
$total = $userService->findMassMailingUserCount($ignoreUnsubscribe, $data['userRoles']);
while ($start < $total) {
$result = $this->userService->findMassMailingUsers($start, $count, $ignoreUnsubscribe, $data['userRoles']);
$mails = array();
$userIdList = array();
foreach ($result as $user) {
$userIdList[] = $user->id;
}
$displayNameList = $this->userService->getDisplayNamesForList($userIdList);
$event = new BASE_CLASS_EventCollector('base.add_global_lang_keys');
OW::getEventManager()->trigger($event);
$vars = call_user_func_array('array_merge', $event->getData());
foreach ($result as $key => $user) {
$vars['user_email'] = $user->email;
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail($user->email);
$vars['user_name'] = $displayNameList[$user->id];
$code = md5($user->username . $user->password);
$link = OW::getRouter()->urlForRoute('base_massmailing_unsubscribe', array('id' => $user->id, 'code' => $code));
$subjectText = UTIL_String::replaceVars($data['subject'], $vars);
$mail->setSubject($subjectText);
if ($data['emailFormat'] === self::EMAIL_FORMAT_HTML) {
$htmlContent = UTIL_String::replaceVars($data['body'], $vars);
$htmlContent .= $language->text('admin', 'massmailing_unsubscribe_link_html', array('link' => $link));
$mail->setHtmlContent($htmlContent);
$textContent = preg_replace("/\\<br\\s*[\\/]?\\s*\\>/", "\n", $htmlContent);
$textContent = strip_tags($textContent);
$mail->setTextContent($textContent);
} else {
//.........這裏部分代碼省略.........
示例13: processResetForm
public function processResetForm($data)
{
$language = OW::getLanguage();
$email = trim($data['email']);
$user = $this->findByEmail($email);
if ($user === null) {
throw new LogicException($language->text('base', 'forgot_password_no_user_error_message'));
}
$resetPassword = $this->findResetPasswordByUserId($user->getId());
if ($resetPassword !== null) {
if ($resetPassword->getUpdateTimeStamp() > time()) {
throw new LogicException($language->text('base', 'forgot_password_request_exists_error_message'));
} else {
$resetPassword->setUpdateTimeStamp($resetPassword->getUpdateTimeStamp() + self::PASSWORD_RESET_CODE_UPDATE_TIME);
$this->resetPasswordDao->save($resetPassword);
}
} else {
$resetPassword = $this->getNewResetPassword($user->getId());
}
$vars = array('code' => $resetPassword->getCode(), 'username' => $user->getUsername(), 'requestUrl' => OW::getRouter()->urlForRoute('base.reset_user_password_request'), 'resetUrl' => OW::getRouter()->urlForRoute('base.reset_user_password', array('code' => $resetPassword->getCode())));
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail($email);
$mail->setSubject($language->text('base', 'reset_password_mail_template_subject'));
$mail->setTextContent($language->text('base', 'reset_password_mail_template_content_txt', $vars));
$mail->setHtmlContent($language->text('base', 'reset_password_mail_template_content_html', $vars));
OW::getMailer()->send($mail);
}
示例14: sendWinkNotification
public function sendWinkNotification($userId, $partnerId)
{
if (empty($userId) || empty($partnerId) || ($user = BOL_UserService::getInstance()->findUserById($userId)) === null || ($partner = BOL_UserService::getInstance()->findUserById($partnerId)) === null) {
return;
}
$avatarUrls = BOL_AvatarService::getInstance()->getAvatarsUrlList(array($userId, $partnerId));
$displayNames = BOL_UserService::getInstance()->getDisplayNamesForList(array($userId, $partnerId));
$subjectKey = 'wink_back_email_subject';
$subjectArr = array('displayname' => $displayNames[$userId]);
$textContentKey = 'wink_back_email_text_content';
$htmlContentKey = 'wink_back_email_html_content';
$contentArr = array('src' => $avatarUrls[$userId], 'displayname' => $displayNames[$userId], 'url' => OW_URL_HOME . 'user/' . $user->getUsername(), 'conversation_url' => OW_URL_HOME . 'messages');
$language = OW::getLanguage();
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail($partner->getEmail());
$mail->setSubject($language->text('winks', $subjectKey, $subjectArr));
$mail->setTextContent($language->text('winks', $textContentKey, $contentArr));
$mail->setHtmlContent($language->text('winks', $htmlContentKey, $contentArr));
try {
OW::getMailer()->send($mail);
} catch (Exception $e) {
OW::getLogger('wink.send_notify')->addEntry(json_encode($e));
}
}
示例15: sendMembershipRenewedNotification
/**
* @param $userId
* @param $membershipLabel
* @return bool
*/
public function sendMembershipRenewedNotification($userId, $membershipLabel)
{
if (!$userId) {
return false;
}
$user = BOL_UserService::getInstance()->findUserById($userId);
if (!$user) {
return false;
}
$lang = OW::getLanguage();
$email = $user->email;
$subject = $lang->text('membership', 'plan_renewed_notification_subject');
$assigns = array('membership' => $membershipLabel, 'name' => BOL_UserService::getInstance()->getDisplayName($userId));
$text = $lang->text('membership', 'plan_renewed_notification_text', $assigns);
$html = $lang->text('membership', 'plan_renewed_notification_html', $assigns);
try {
$mail = OW::getMailer()->createMail()->addRecipientEmail($email)->setTextContent($text)->setHtmlContent($html)->setSubject($subject);
OW::getMailer()->send($mail);
} catch (Exception $e) {
return false;
}
return true;
}