public function sendActivationEmail(UserInfo $ui)
 {
     $mh = Loader::helper('mail');
     $mh->to($ui->getUserEmail());
     if (Config::get('concrete.user.registration.notification_email')) {
         $mh->from(Config::get('concrete.user.registration.notification_email'), t('Website Registration Notification'));
     } else {
         $adminUser = UserInfo::getByID(USER_SUPER_ID);
         $mh->from($adminUser->getUserEmail(), t('Website Registration Notification'));
     }
     $mh->addParameter('uID', $ui->getUserID());
     $mh->addParameter('user', $ui);
     $mh->addParameter('uName', $ui->getUserName());
     $mh->addParameter('uEmail', $ui->getUserEmail());
     $mh->addParameter('siteName', \Core::make('site')->getSite()->getSiteName());
     $mh->load('user_registered_approval_complete');
     $mh->sendMail();
 }
Example #2
0
 /**
  * @param UserInfo $recipient
  * @param string $subject
  * @param string $text
  * @param \Concrete\Core\User\PrivateMessage\PrivateMessage $inReplyTo
  *
  * @return \Concrete\Core\Error\Error|false|null
  */
 public function sendPrivateMessage($recipient, $subject, $text, $inReplyTo = false)
 {
     if (Limit::isOverLimit($this->getUserID())) {
         return Limit::getErrorObject();
     }
     $antispam = Core::make('helper/validation/antispam');
     $messageText = t('Subject: %s', $subject);
     $messageText .= "\n";
     $messageText .= t('Message: %s', $text);
     $additionalArgs = array('user' => $this);
     if (!$antispam->check($messageText, 'private_message', $additionalArgs)) {
         return false;
     }
     $subject = $subject == '' ? t('(No Subject)') : $subject;
     $db = $this->connection;
     $dt = Core::make('helper/date');
     $msgDateCreated = $dt->getOverridableNow();
     $v = array($this->getUserID(), $msgDateCreated, $subject, $text, $recipient->getUserID());
     $db->Execute('insert into UserPrivateMessages (uAuthorID, msgDateCreated, msgSubject, msgBody, uToID) values (?, ?, ?, ?, ?)', $v);
     $msgID = $db->Insert_ID();
     if ($msgID > 0) {
         // we add the private message to the sent box of the sender, and the inbox of the recipient
         $v = array($msgID, $this->getUserID(), $this->getUserID(), UserPrivateMessageMailbox::MBTYPE_SENT, 0, 1);
         $db->Execute('insert into UserPrivateMessagesTo (msgID, uID, uAuthorID, msgMailboxID, msgIsNew, msgIsUnread) values (?, ?, ?, ?, ?, ?)', $v);
         $v = array($msgID, $recipient->getUserID(), $this->getUserID(), UserPrivateMessageMailbox::MBTYPE_INBOX, 1, 1);
         $db->Execute('insert into UserPrivateMessagesTo (msgID, uID, uAuthorID, msgMailboxID, msgIsNew, msgIsUnread) values (?, ?, ?, ?, ?, ?)', $v);
     }
     // If the message is in reply to another message, we make a note of that here
     if (is_object($inReplyTo)) {
         $db->Execute('update UserPrivateMessagesTo set msgIsReplied = 1 where uID = ? and msgID = ?', array($this->getUserID(), $inReplyTo->getMessageID()));
     }
     // send the email notification
     if ($recipient->getAttribute('profile_private_messages_notification_enabled')) {
         $mh = Core::make('mail');
         $mh->addParameter('msgSubject', $subject);
         $mh->addParameter('msgBody', $text);
         $mh->addParameter('msgAuthor', $this->getUserName());
         $mh->addParameter('msgDateCreated', $msgDateCreated);
         $mh->addParameter('profileURL', $this->getUserPublicProfileUrl());
         $mh->addParameter('profilePreferencesURL', View::url('/account/profile/edit'));
         $mh->to($recipient->getUserEmail());
         $mh->addParameter('siteName', Config::get('concrete.site'));
         $mi = MailImporter::getByHandle("private_message");
         if (is_object($mi) && $mi->isMailImporterEnabled()) {
             $mh->load('private_message_response_enabled');
             // we store information ABOUT the message here. The mail handler has to know how to handle this.
             $data = new \stdClass();
             $data->msgID = $msgID;
             $data->toUID = $recipient->getUserID();
             $data->fromUID = $this->getUserID();
             $mh->enableMailResponseProcessing($mi, $data);
         } else {
             $mh->load('private_message');
         }
         $mh->sendMail();
     }
 }
Example #3
0
 public function getUserEmail()
 {
     return parent::getUserEmail();
 }