Skip to content

Commit

Permalink
Merge pull request #40151 from summersab/refactor/OC-Server-getMailer
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored May 30, 2024
2 parents 22f1854 + 9866629 commit 94a1b8a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/private/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*
* Example usage:
*
* $mailer = \OC::$server->getMailer();
* $mailer = \OC::$server->get(\OCP\Mail\IMailer::class);
* $message = $mailer->createMessage();
* $message->setSubject('Your Subject');
* $message->setFrom(array('[email protected]' => 'ownCloud Notifier'));
Expand Down
5 changes: 3 additions & 2 deletions lib/private/Share20/ProviderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use OCP\Files\IRootFolder;
use OCP\Http\Client\IClientService;
use OCP\IServerContainer;
use OCP\Mail\IMailer;
use OCP\Security\IHasher;
use OCP\Share\IManager;
use OCP\Share\IProviderFactory;
Expand Down Expand Up @@ -79,7 +80,7 @@ protected function defaultShareProvider() {
$this->serverContainer->getUserManager(),
$this->serverContainer->getGroupManager(),
$this->serverContainer->get(IRootFolder::class),
$this->serverContainer->getMailer(),
$this->serverContainer->get(IMailer::class),
$this->serverContainer->query(Defaults::class),
$this->serverContainer->getL10NFactory(),
$this->serverContainer->getURLGenerator(),
Expand Down Expand Up @@ -172,7 +173,7 @@ protected function getShareByMailProvider() {
$this->serverContainer->get(IRootFolder::class),
$this->serverContainer->getL10N('sharebymail'),
$this->serverContainer->get(LoggerInterface::class),
$this->serverContainer->getMailer(),
$this->serverContainer->get(IMailer::class),
$this->serverContainer->getURLGenerator(),
$this->serverContainer->getActivityManager(),
$settingsManager,
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Mail/IMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* Example usage:
*
* $mailer = \OC::$server->getMailer();
* $mailer = \OC::$server->get(\OCP\Mail\IMailer::class);
* $message = $mailer->createMessage();
* $message->setSubject('Your Subject');
* $message->setFrom(['[email protected]' => 'Nextcloud Notifier']);
Expand Down
3 changes: 2 additions & 1 deletion lib/public/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use bantu\IniGetWrapper\IniGetWrapper;
use OC\AppScriptDependency;
use OC\AppScriptSort;
use OCP\Mail\IMailer;
use OCP\Share\IManager;
use Psr\Container\ContainerExceptionInterface;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -302,7 +303,7 @@ public static function getDefaultEmailAddress(string $user_part): string {
$host_name = $config->getSystemValueString('mail_domain', $host_name);
$defaultEmailAddress = $user_part.'@'.$host_name;

$mailer = \OC::$server->getMailer();
$mailer = \OC::$server->get(IMailer::class);
if ($mailer->validateMailAddress($defaultEmailAddress)) {
return $defaultEmailAddress;
}
Expand Down

0 comments on commit 94a1b8a

Please sign in to comment.