本文整理汇总了PHP中UserMailer类的典型用法代码示例。如果您正苦于以下问题:PHP UserMailer类的具体用法?PHP UserMailer怎么用?PHP UserMailer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserMailer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: contact
private function contact()
{
global $wgEmergencyContact;
$this->getOutput()->addModules('skins.settlein.special.contact');
$this->getOutput()->setPageTitle('Contact Us | SettleIn');
$data = array();
if ($this->getRequest()->wasPosted()) {
$name = $this->getRequest()->getVal('name');
$email = $this->getRequest()->getVal('email');
$message = $this->getRequest()->getVal('message');
$reason = $this->getRequest()->getVal('reason');
$reason = wfMessage('settlein-skin-project-page-contact-field-reason-value-' . ((int) $reason + 1))->plain();
$to = new MailAddress($wgEmergencyContact);
$from = new MailAddress($email, $name);
$subject = "New request from SettleIn website";
$body = "Reason: " . $reason . "\n\n" . $message;
UserMailer::send($to, $from, $subject, $body);
$this->getOutput()->redirect($this->getFullTitle()->getFullURL('success=yes'));
return false;
} else {
if ($this->getRequest()->getVal('success')) {
$html = Views::forge('contactpost_new', $data);
} else {
$html = Views::forge('contact_new', $data);
}
}
$this->getOutput()->addHTML($html);
}
示例2: execute
public function execute($subpage)
{
global $wgRequest, $wgForceSendgridEmail, $wgForceSchwartzEmail;
wfProfileIn(__METHOD__);
// Don't allow just anybody to use this
if ($this->mChallengeToken != $wgRequest->getVal('challenge')) {
header("Status: 400");
header("Content-type: text/plain");
print "Challenge incorrect";
wfProfileOut(__METHOD__);
exit;
}
// Make sure we get an email address
$this->mAccount = $wgRequest->getVal('account');
if (!$this->mAccount) {
header("Status: 400");
header("Content-type: text/plain");
print "Parameter 'account' required";
wfProfileOut(__METHOD__);
exit;
}
# These two both have defaults
$this->mText = $wgRequest->getVal('text', $this->mText);
$this->mConfirmToken = $wgRequest->getVal('token', $this->mConfirmToken);
$wgForceSendgridEmail = $wgRequest->getVal('force') == 'sendgrid';
$wgForceSchwartzEmail = $wgRequest->getVal('force') == 'schwartz';
UserMailer::send(new MailAddress($this->mAccount), new MailAddress('test@wikia-inc.com'), "EmailTest - End to end test", $this->mConfirmToken . "\n" . $this->mText, null, null, "emailtest");
header("Status: 200");
header("Content-type: text/plain");
print $this->mConfirmToken;
wfProfileOut(__METHOD__);
exit;
}
示例3: execute
public function execute()
{
$params = $this->extractRequestParams();
// Validation
if (!User::isValidEmailAddr($params['email'])) {
$this->dieUsage('The email address does not appear to be valid', 'invalidemail');
}
// Verification code
$code = md5('EmailCapture' . time() . $params['email'] . $params['info']);
// Insert
$dbw = wfGetDB(DB_MASTER);
$dbw->insert('email_capture', array('ec_email' => $params['email'], 'ec_info' => isset($params['info']) ? $params['info'] : null, 'ec_code' => $code), __METHOD__, array('IGNORE'));
if ($dbw->affectedRows()) {
// Send auto-response
global $wgEmailCaptureSendAutoResponse, $wgEmailCaptureAutoResponse;
$title = SpecialPage::getTitleFor('EmailCapture');
$link = $title->getCanonicalURL();
$fullLink = $title->getCanonicalURL(array('verify' => $code));
if ($wgEmailCaptureSendAutoResponse) {
UserMailer::send(new MailAddress($params['email']), new MailAddress($wgEmailCaptureAutoResponse['from'], $wgEmailCaptureAutoResponse['from-name']), wfMsg($wgEmailCaptureAutoResponse['subject-msg']), wfMsg($wgEmailCaptureAutoResponse['body-msg'], $fullLink, $link, $code), $wgEmailCaptureAutoResponse['reply-to'], $wgEmailCaptureAutoResponse['content-type']);
}
$r = array('result' => 'Success');
} else {
$r = array('result' => 'Failure', 'message' => 'Duplicate email address');
}
$this->getResult()->addValue(null, $this->getModuleName(), $r);
}
示例4: sendMail
/**
* Quickie wrapper function for sending out an email as properly rendered
* HTML instead of plaintext.
*
* The functions in this class that call this function used to use
* User::sendMail(), but it was causing the mentioned bug, hence why this
* function had to be introduced.
*
* @see https://bugzilla.wikimedia.org/show_bug.cgi?id=68045
*
* @param User $string User (object) whom to send an email
* @param string $subject Email subject
* @param $string $body Email contents (HTML)
* @return Status object
*/
public function sendMail($user, $subject, $body)
{
global $wgPasswordSender;
$sender = new MailAddress($wgPasswordSender, wfMessage('emailsender')->inContentLanguage()->text());
$to = new MailAddress($user);
return UserMailer::send($to, $sender, $subject, $body, null, 'text/html; charset=UTF-8');
}
示例5: after_create
public function after_create()
{
UserMailer::deliver_new_user($this->email, $this);
$path = FileUtils::join(NIMBLE_ROOT, 'get', $this->username);
FileUtils::mkdir_p($path);
chmod($path, 0755);
}
示例6: sendExternalMails
/**
* Send email to external addresses
*/
private function sendExternalMails()
{
global $wgNewUserNotifEmailTargets, $wgSitename;
foreach ($wgNewUserNotifEmailTargets as $target) {
UserMailer::send(new MailAddress($target), new MailAddress($this->sender), $this->makeSubject($target, $this->user), $this->makeMessage($target, $this->user));
}
}
示例7: notifyWithEmail
/**
* Send a Notification to a user by email
*
* @param $user User to notify.
* @param $event EchoEvent to notify about.
* @return bool
*/
public static function notifyWithEmail($user, $event)
{
// No valid email address or email notification
if (!$user->isEmailConfirmed() || $user->getOption('echo-email-frequency') < 0) {
return false;
}
// Final check on whether to send email for this user & event
if (!wfRunHooks('EchoAbortEmailNotification', array($user, $event))) {
return false;
}
// See if the user wants to receive emails for this category or the user is eligible to receive this email
if (in_array($event->getType(), EchoNotificationController::getUserEnabledEvents($user, 'email'))) {
global $wgEchoEnableEmailBatch, $wgEchoNotifications, $wgNotificationSender, $wgNotificationSenderName, $wgNotificationReplyName, $wgEchoBundleEmailInterval;
$priority = EchoNotificationController::getNotificationPriority($event->getType());
$bundleString = $bundleHash = '';
// We should have bundling for email digest as long as either web or email bundling is on, for example, talk page
// email bundling is off, but if a user decides to receive email digest, we should bundle those messages
if (!empty($wgEchoNotifications[$event->getType()]['bundle']['web']) || !empty($wgEchoNotifications[$event->getType()]['bundle']['email'])) {
wfRunHooks('EchoGetBundleRules', array($event, &$bundleString));
}
if ($bundleString) {
$bundleHash = md5($bundleString);
}
MWEchoEventLogging::logSchemaEcho($user, $event, 'email');
// email digest notification ( weekly or daily )
if ($wgEchoEnableEmailBatch && $user->getOption('echo-email-frequency') > 0) {
// always create a unique event hash for those events don't support bundling
// this is mainly for group by
if (!$bundleHash) {
$bundleHash = md5($event->getType() . '-' . $event->getId());
}
MWEchoEmailBatch::addToQueue($user->getId(), $event->getId(), $priority, $bundleHash);
return true;
}
$addedToQueue = false;
// only send bundle email if email bundling is on
if ($wgEchoBundleEmailInterval && $bundleHash && !empty($wgEchoNotifications[$event->getType()]['bundle']['email'])) {
$bundler = MWEchoEmailBundler::newFromUserHash($user, $bundleHash);
if ($bundler) {
$addedToQueue = $bundler->addToEmailBatch($event->getId(), $priority);
}
}
// send single notification if the email wasn't added to queue for bundling
if (!$addedToQueue) {
// instant email notification
$toAddress = new MailAddress($user);
$fromAddress = new MailAddress($wgNotificationSender, $wgNotificationSenderName);
$replyAddress = new MailAddress($wgNotificationSender, $wgNotificationReplyName);
// Since we are sending a single email, should set the bundle hash to null
// if it is set with a value from somewhere else
$event->setBundleHash(null);
$email = EchoNotificationController::formatNotification($event, $user, 'email', 'email');
$subject = $email['subject'];
$body = $email['body'];
UserMailer::send($toAddress, $fromAddress, $subject, $body, $replyAddress);
MWEchoEventLogging::logSchemaEchoMail($user, 'single');
}
}
return true;
}
示例8: sendEmail
function sendEmail(&$u, &$content)
{
global $wgServer;
wfLoadExtensionMessages('ThumbsEmailNotifications');
$email = $u->getEmail();
$userText = $u->getName();
$semi_rand = md5(time());
$mime_boundary = "==MULTIPART_BOUNDARY_{$semi_rand}";
$mime_boundary_header = chr(34) . $mime_boundary . chr(34);
$userPageLink = self::getUserPageLink($userText);
$html_text = wfMsg('tn_email_html', wfGetPad(''), $userPageLink, $content);
$plain_text = wfMsg('tn_email_plain', $userText, $u->getTalkPage()->getFullURL());
$body = "This is a multi-part message in MIME format.\n\n--{$mime_boundary}\nContent-Type: text/plain; charset=us-ascii\nContent-Transfer-Encoding: 7bit\n\n{$plain_text}\n\n--{$mime_boundary}\nContent-Type: text/html; charset=us-ascii\nContent-Transfer-Encoding: 7bit\n\n{$html_text}";
$from = new MailAddress(wfMsg('aen_from'));
$subject = "Congratulations! You just got a thumbs up";
$isDev = false;
if (strpos($_SERVER['HOSTNAME'], "wikidiy.com") !== false || strpos($wgServer, "wikidiy.com") !== false) {
wfDebug("AuthorEmailNotification in dev not notifying: TO: " . $userText . ",FROM: {$from_name}\n");
$isDev = true;
$subject = "[FROM DEV] {$subject}";
}
if (!$isDev) {
$to = new MailAddress($email);
UserMailer::send($to, $from, $subject, $body, null, "multipart/alternative;\n" . " boundary=" . $mime_boundary_header);
}
// send one to our test email account for debugging
/*
$to = new MailAddress ('elizabethwikihowtest@gmail.com');
UserMailer::send($to, $from, $subject, $body, null, "multipart/alternative;\n" .
" boundary=" . $mime_boundary_header) ;
*/
return true;
}
示例9: run
/**
* Run a SMW_NMSendMailJob job
* @return boolean success
*/
function run()
{
wfDebug(__METHOD__);
wfProfileIn(__METHOD__);
UserMailer::send($this->params['to'], $this->params['from'], $this->params['subj'], $this->params['body'], $this->params['replyto']);
wfProfileOut(__METHOD__);
return true;
}
示例10: saveStory
/**
* Store the submitted story in the database, and return a page telling the user his story has been submitted.
*
* @param string $title
*/
private function saveStory($title)
{
global $wgRequest, $wgUser;
global $egStoryboardEmailSender, $egStoryboardEmailSenderName, $egStoryboardBoardUrl;
$dbw = wfGetDB(DB_MASTER);
$story = array('story_lang_code' => $wgRequest->getText('lang'), 'story_author_name' => $wgRequest->getText('name'), 'story_author_location' => $wgRequest->getText('location'), 'story_author_occupation' => $wgRequest->getText('occupation'), 'story_author_email' => $wgRequest->getText('email'), 'story_title' => $title, 'story_text' => $wgRequest->getText('storytext'), 'story_created' => $dbw->timestamp(time()), 'story_modified' => $dbw->timestamp(time()));
// If the user is logged in, also store his user id.
if ($wgUser->isLoggedIn()) {
$story['story_author_id'] = $wgUser->getId();
}
$dbw->insert('storyboard', $story);
$to = new MailAddress($wgRequest->getText('email'), $wgRequest->getText('name'));
$from = new MailAddress($egStoryboardEmailSender, $egStoryboardEmailSenderName);
$subject = wfMsg('storyboard-emailtitle');
$body = wfMsgExt('storyboard-emailbody', 'parsemag', $title, $egStoryboardBoardUrl);
$mailer = new UserMailer();
$mailer->send($to, $from, $subject, $body);
}
示例11: execute
public function execute()
{
$fb = $this->getMain()->getVal('feedback');
$user = $this->getUser();
$subject = "用户bug反馈";
$body = json_decode($fb);
if ($user != '') {
if ($body->note != '') {
$trueSubject = $user->getName() . ":" . $body->note;
} else {
$trueSubject = $user->getName() . ":" . $body->note;
}
} else {
if ($body->note != '') {
$trueSubject = $body->note;
} else {
$trueSubject = $subject;
}
}
$fs = wfGetFS(FS_OSS);
$time = microtime();
$id = HuijiFunctions::getTradeNo('FB');
$fs->put("Feedback/{$id}.html", $body->html);
$data = str_replace('data:image/png;base64,', '', $body->img);
$data = str_replace(' ', '+', $data);
$data = base64_decode($data);
$source_img = imagecreatefromstring($data);
imagepng($source_img, "/tmp/{$id}.png", 3);
$fs->put("Feedback/{$id}.png", file_get_contents("/tmp/{$id}.png"));
imagedestroy($source_img);
$trueBody = $this->getSection('Issue');
$trueBody .= $body->note;
$trueBody .= $this->getSection('Cookie');
foreach ($_COOKIE as $key => $value) {
$trueBody .= $key . ":" . $value . ";" . PHP_EOL;
}
$trueBody .= $this->getSection('URL');
$trueBody .= $body->url;
$trueBody .= $this->getSection('源代码');
$trueBody .= "http://fs.huijiwiki.com/Feedback/{$id}.html";
$trueBody .= $this->getSection('Agent');
foreach ($body->browser as $key => $value) {
if (is_array($value)) {
$trueBody .= $key . ":" . implode(", ", $value) . ";" . PHP_EOL;
} else {
$trueBody .= $key . ":" . $value . ";" . PHP_EOL;
}
}
$trueBody .= $this->getSection('来源');
$trueBody .= $body->referer;
$trueBody .= $this->getSection('分辨率');
$trueBody .= $body->w . "X" . $body->h;
$trueBody .= $this->getSection('截图');
$trueBody .= "http://fs.huijiwiki.com/Feedback/{$id}.png";
$res = UserMailer::send(new MailAddress('xigu+4v9xc1lkbgfsjexbgigj@boards.trello.com', 'trello', 'trello'), new MailAddress("no-reply@huiji.wiki"), $trueSubject, $trueBody);
$this->getResult()->addValue(null, $this->getModuleName(), $res);
}
示例12: sendEmail
function sendEmail() {
$from = new MailAddress("community@wikia-inc.com");
$to = new MailAddress("garth@wikia-inc.com");
$body = "Test sendgrid email";
$headers = array( "X-Msg-Category" => "Test" );
$subject = "This is a sendgrid test";
UserMailer::send($to, $from, $subject, $body);
}
示例13: sendMessage
function sendMessage(\PageAttachment\User\User $user, $subject, $message)
{
global $wgNoReplyAddress;
global $wgPasswordSender;
$to = new \MailAddress($user->getEmailAddress());
$from = new \MailAddress($wgPasswordSender);
$replyTo = new \MailAddress($wgNoReplyAddress);
\UserMailer::send($to, $from, $subject, $message, $replyTo);
}
示例14: check_existence_of_spamfile
function check_existence_of_spamfile($email)
{
global $wgSitename, $wgCityId;
$articles = getWikiArticles();
if (!empty($articles)) {
ob_start();
echo $wgSitename, "\n";
print_r($articles);
$body = ob_get_clean();
UserMailer::send(new MailAddress($email), new MailAddress($email), 'Spam list related pages in NS=8 on ' . $wgSitename . ' - ' . $wgCityId, $body);
}
}
示例15: notifyUser
/**
* Notifies a single user of the changes made to properties in a single edit.
*
* @since 0.1
*
* @param SWLGroup $group
* @param User $user
* @param SWLChangeSet $changeSet
* @param boolean $describeChanges
*
* @return Status
*/
public static function notifyUser(SWLGroup $group, User $user, SWLChangeSet $changeSet, $describeChanges)
{
global $wgLang, $wgPasswordSender, $wgPasswordSenderName;
$emailText = wfMsgExt('swl-email-propschanged-long', 'parse', $GLOBALS['wgSitename'], $changeSet->getEdit()->getUser()->getName(), SpecialPage::getTitleFor('SemanticWatchlist')->getFullURL(), $wgLang->time($changeSet->getEdit()->getTime()), $wgLang->date($changeSet->getEdit()->getTime()));
if ($describeChanges) {
$emailText .= '<h3> ' . wfMsgExt('swl-email-changes', 'parse', $changeSet->getEdit()->getTitle()->getFullText(), $changeSet->getEdit()->getTitle()->getFullURL()) . ' </h3>';
$emailText .= self::getChangeListHTML($changeSet, $group);
}
$title = wfMsgReal('swl-email-propschanged', array($changeSet->getEdit()->getTitle()->getFullText()), true, $user->getOption('language'));
wfRunHooks('SWLBeforeEmailNotify', array($group, $user, $changeSet, $describeChanges, &$title, &$emailText));
return UserMailer::send(new MailAddress($user), new MailAddress($wgPasswordSender, $wgPasswordSenderName), $title, $emailText, null, 'text/html; charset=ISO-8859-1');
}