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


PHP Util::sendMail方法代码示例

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


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

示例1: sendMail

 public static function sendMail($path)
 {
     if (!\OCP\User::isLoggedIn()) {
         return;
     }
     $email = \OCP\Config::getUserValue(\OCP\User::getUser(), 'settings', 'email', '');
     \OCP\Util::writeLog('files_antivirus', 'Email: ' . $email, \OCP\Util::DEBUG);
     if (!empty($email)) {
         $defaults = new \OCP\Defaults();
         $tmpl = new \OCP\Template('files_antivirus', 'notification');
         $tmpl->assign('file', $path);
         $tmpl->assign('host', \OCP\Util::getServerHost());
         $tmpl->assign('user', \OCP\User::getDisplayName());
         $msg = $tmpl->fetchPage();
         $from = \OCP\Util::getDefaultEmailAddress('security-noreply');
         \OCP\Util::sendMail($email, \OCP\User::getUser(), \OCP\Util::getL10N('files_antivirus')->t('Malware detected'), $msg, $from, $defaults->getName(), true);
     }
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:18,代码来源:notification.php

示例2: mailUserDeletion

 /**
  * Send a mail signaling a user deletion
  * @param \OC\User\User $user
  */
 public function mailUserDeletion(\OC\User\User $user)
 {
     $toAddress = $toName = $this->config->getSystemValue('monitoring_admin_email');
     $theme = new \OC_Defaults();
     $now = new \DateTime();
     $niceNow = date_format($now, 'd/m/Y H:i:s');
     $subject = (string) $this->l->t('%s - User %s just has been deleted (%s)', array($theme->getTitle(), $user->getUID(), $niceNow));
     $html = new \OCP\Template($this->appName, "mail_userdeletion_html", "");
     $html->assign('userUID', $user->getUID());
     $html->assign('datetime', $niceNow);
     $htmlMail = $html->fetchPage();
     $alttext = new \OCP\Template($this->appName, "mail_userdeletion_text", "");
     $alttext->assign('userUID', $user->getUID());
     $alttext->assign('datetime', $niceNow);
     $altMail = $alttext->fetchPage();
     $fromAddress = $fromName = \OCP\Util::getDefaultEmailAddress('owncloud');
     try {
         \OCP\Util::sendMail($toAddress, $toName, $subject, $htmlMail, $fromAddress, $fromName, 1, $altMail);
     } catch (\Exception $e) {
         \OCP\Util::writeLog('user_account_actions', "Can't send mail for user deletion: " . $e->getMessage(), \OCP\Util::ERROR);
     }
 }
开发者ID:Victor-Bordage-Gorry,项目名称:user_account_actions,代码行数:26,代码来源:mailaction.php

示例3: sendMail

 /**
  * send an email
  * @param string $toaddress
  * @param string $toname
  * @param string $subject
  * @param string $mailtext
  * @param string $fromaddress
  * @param string $fromname
  * @param int $html
  * @param string $altbody
  * @param string $ccaddress
  * @param string $ccname
  * @param string $bcc
  */
 public function sendMail($toaddress, $toname = "WeatherCloud User", $subject = "Verify your WeatherCloud registration request", $mailtext, $fromaddress, $fromname = "WeatherCloud", $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '')
 {
     // call the internal mail class
     \OCP\Util::sendMail($toaddress, $toname = "WeatherCloud User", $subject = "Verify your WeatherCloud registration request", $mailtext, $fromaddress, $fromname = "WeatherCloud", $html, $altbody, $ccaddress, $ccname, $bcc);
 }
开发者ID:WeatherellTechnology,项目名称:weatherstorm7,代码行数:19,代码来源:mail.php

示例4: sendLinkShareMail

	/**
	 * inform recipient about public link share
	 *
	 * @param string $recipient recipient email address
	 * @param string $filename the shared file
	 * @param string $link the public link
	 * @param int $expiration expiration date (timestamp)
	 * @return array $result of failed recipients
	 */
	public function sendLinkShareMail($recipient, $filename, $link, $expiration) {
		$subject = (string)$this->l->t('%s shared »%s« with you', array($this->senderDisplayName, $filename));
		list($htmlMail, $alttextMail) = $this->createMailBody($filename, $link, $expiration);
		$rs = explode(' ', $recipient);
		$failed = array();
		foreach ($rs as $r) {
			try {
				\OCP\Util::sendMail($r, $r, $subject, $htmlMail, $this->from, $this->senderDisplayName, 1, $alttextMail);
			} catch (\Exception $e) {
				\OCP\Util::writeLog('sharing', "Can't send mail with public link to $r: " . $e->getMessage(), \OCP\Util::ERROR);
				$failed[] = $r;
			}
		}
		return $failed;
	}
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:24,代码来源:mailnotifications.php

示例5: sendEmailToUser

 /**
  * Send a notification to one user
  *
  * @param string $user Username of the recipient
  * @param string $email Email address of the recipient
  * @param string $lang Selected language of the recipient
  * @param array $mailData Notification data we send to the user
  */
 public function sendEmailToUser($user, $email, $lang, $mailData)
 {
     $l = $this->getLanguage($lang);
     $dataHelper = new DataHelper(\OC::$server->getActivityManager(), new ParameterHelper(new \OC\Files\View(''), $l), $l);
     $activityList = array();
     foreach ($mailData as $activity) {
         $activityList[] = array($dataHelper->translation($activity['amq_appid'], $activity['amq_subject'], unserialize($activity['amq_subjectparams'])), $this->generateRelativeDatetime($l, $activity['amq_timestamp']));
     }
     $alttext = new \OCP\Template('activity', 'email.notification', '');
     $alttext->assign('username', \OCP\User::getDisplayName($user));
     $alttext->assign('timeframe', $this->getLangForApproximatedTimeFrame($mailData[0]['amq_timestamp']));
     $alttext->assign('activities', $activityList);
     $alttext->assign('owncloud_installation', \OC_Helper::makeURLAbsolute('/'));
     $alttext->assign('overwriteL10N', $l);
     $emailText = $alttext->fetchPage();
     try {
         \OCP\Util::sendMail($email, $user, $l->t('Activity notification'), $emailText, $this->getSenderData('email'), $this->getSenderData('name'));
     } catch (\Exception $e) {
         \OCP\Util::writeLog('Activity', 'A problem occurred while sending the e-mail. Please revisit your settings.', \OCP\Util::ERROR);
     }
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:29,代码来源:mailqueuehandler.php

示例6: array

    $recipientList = array('name' => array(), 'email' => array());
    $sendTo = explode(',', $recipients);
    foreach ($sendTo as $recipient) {
        if (preg_match_all($pattern, $recipient, $matches)) {
            // We have 'John Doe <email@example.org>'
            $recipientList['name'][] = $matches[1][0];
            $recipientList['email'][] = $matches[2][0];
        } else {
            // Name is unknown, we have  email@example.org
            $recipientList['name'][] = '';
            $recipientList['email'][] = $recipient;
        }
    }
    //We only use the first recipient atm. (OC_Mail doesn't support multiple CC)
    $nameTo = array_shift($recipientList['name']);
    $emailTo = array_shift($recipientList['email']);
    try {
        $emailFrom = \OCP\Util::getDefaultEmailAddress('noreply');
        \OCP\Util::sendMail($emailTo, $nameTo, $subject, $message, $emailFrom, $nameFrom);
    } catch (Exception $e) {
        $status = false;
    }
} else {
    $status = false;
}
if ($status) {
    \OCP\JSON::success(array());
} else {
    \OCP\JSON::error(array());
}
exit;
开发者ID:DOM-Digital-Online-Media,项目名称:apps,代码行数:31,代码来源:share.php

示例7: OC_Template

            $text = $content->fetchPage();
            $content = new OC_Template("core", "altmail", "");
            $content->assign('link', $link);
            $content->assign('type', $type);
            $content->assign('user_displayname', $displayName);
            $content->assign('filename', $file);
            $content->assign('expiration', $expiration);
            $alttext = $content->fetchPage();
            $default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply');
            $from_address = OCP\Config::getUserValue($user, 'settings', 'email', $default_from);
            // send it out now
            $rs = explode(' ', $to_address);
            $failed = array();
            foreach ($rs as $r) {
                try {
                    \OCP\Util::sendMail($r, $r, $subject, $text, $from_address, $displayName, 1, $alttext);
                } catch (\Exception $e) {
                    \OCP\Util::writeLog('sharing', "Can't send mail with public link to {$r}: " . $e->getMessage(), \OCP\Util::ERROR);
                    $failed[] = $r;
                }
            }
            if (empty($failed)) {
                OCP\JSON::success();
            } else {
                OCP\JSON::error(array('data' => array('message' => $l->t("Couldn't send mail to following users: %s ", implode(', ', $failed)))));
            }
            break;
    }
} else {
    if (isset($_GET['fetch'])) {
        switch ($_GET['fetch']) {
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:share.php

示例8: sendMail

 /**
  * send an email
  * @param string $toaddress
  * @param string $toname
  * @param string $subject
  * @param string $mailtext
  * @param string $fromaddress
  * @param string $fromname
  * @param int $html
  * @param string $altbody
  * @param string $ccaddress
  * @param string $ccname
  * @param string $bcc
  */
 public function sendMail($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '')
 {
     // call the internal mail class
     \OCP\Util::sendMail($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html, $altbody, $ccaddress, $ccname, $bcc);
 }
开发者ID:j2L4e,项目名称:registration,代码行数:19,代码来源:mail.php

示例9: mailDeleteAccount

 /**
  * Adds the user to the reject group and send an email to the administrator to inform them of the request for deletion
  *
  * @author Victor Bordage-Gorry <victor.bordage-gorry@globalis-ms.com>
  * @copyright 2015 CNRS DSI / GLOBALIS media systems
  *
  * @param     string   $requesterUid    User's Uid
  */
 public function mailDeleteAccount($requesterUid)
 {
     $reason = trim(strip_tags(stripslashes($_POST['deletion_reason'])));
     if (empty($reason) || $reason === '') {
         return false;
     }
     // User modification, add to rejected group
     $user = $this->userManager->get($requesterUid);
     $userGroups = $this->groupManager->getUserGroupIds($user);
     // get the user's exclusion group.
     $configGroups = $this->config->getSystemValue('deletion_account_request_exclusion_groups');
     if (is_array($configGroups)) {
         foreach ($configGroups as $groupKey => $groupValue) {
             if (in_array($groupKey, $userGroups)) {
                 if ($this->groupManager->groupExists($groupValue)) {
                     $group = $this->groupManager->get($groupValue);
                 } else {
                     $group = $this->groupManager->createGroup($groupValue);
                 }
                 break;
             }
         }
     }
     // if $group unset, we use the default value
     if (empty($group)) {
         $val = $this->config->getSystemValue('deletion_account_request_default_exclusion_group');
         if ($this->groupManager->groupExists($val)) {
             $group = $this->groupManager->get($val);
         } else {
             $group = $this->groupManager->createGroup($val);
         }
     }
     $group->addUser($user);
     // get the admin's mail
     $configMails = $this->config->getSystemValue('deletion_account_request_admin_emails');
     if (is_array($configMails)) {
         foreach ($configMails as $mailKey => $mailValue) {
             if (in_array($mailKey, $userGroups)) {
                 $toAddress = $toName = $mailValue;
                 break;
             }
         }
     }
     // if $toAdress unset, we use the default value
     if (empty($toAdress)) {
         $toAddress = $toName = $this->config->getSystemValue('deletion_account_request_default_admin_email');
     }
     // Mail part
     $theme = new \OC_Defaults();
     $subject = (string) $this->l->t('Request for deleting account: %s', array($requesterUid));
     // generate the content
     $html = new \OCP\Template($this->appName, "mail_userdeletion_html", "");
     $html->assign('overwriteL10N', $this->l);
     $html->assign('requesterUid', $requesterUid);
     $html->assign('reason', $_POST['deletion_reason']);
     $htmlMail = $html->fetchPage();
     $alttext = new \OCP\Template($this->appName, "mail_userdeletion_text", "");
     $alttext->assign('overwriteL10N', $this->l);
     $alttext->assign('requesterUid', $requesterUid);
     $alttext->assign('reason', $reason);
     $altMail = $alttext->fetchPage();
     $fromAddress = $fromName = \OCP\Util::getDefaultEmailAddress('owncloud');
     //sending
     try {
         \OCP\Util::sendMail($toAddress, $toName, $subject, $htmlMail, $fromAddress, $fromName, 1, $altMail);
     } catch (\Exception $e) {
         \OCP\Util::writeLog('user_account_actions', "Can't send mail for user creation: " . $e->getMessage(), \OCP\Util::ERROR);
     }
     // logout and redirect
     \OCP\User::logout();
     \OC_Util::redirectToDefaultPage();
     exit;
 }
开发者ID:Victor-Bordage-Gorry,项目名称:user_deletion_request,代码行数:81,代码来源:mailservice.php

示例10: sendMail

 /**
  * send an email
  * @param string $toaddress
  * @param string $toname
  * @param string $subject
  * @param string $mailtext
  * @param string $fromaddress
  * @param string $fromname
  */
 public function sendMail($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname)
 {
     return \OCP\Util::sendMail($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname);
 }
开发者ID:marcdexet-cnrs,项目名称:user_mailinglist,代码行数:13,代码来源:defaultmailer.php


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