forked from nextcloud/server
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Mailer): add "null" SMTP transport mode
== Goal Allow disabling mail delivery altogether. == Usecase If mails ought to be send by other means than rendering messages from templates and sending them via SMTP-like protocols. Example: listening to specific Nextcloud events and pass parameters to a centralized (i.e. REST-based) API that sends e-mails. Signed-off-by: Thomas Lehmann <[email protected]>
- Loading branch information
1 parent
f5ca755
commit 13b3c57
Showing
3 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,7 +113,27 @@ public function testGetSendmailInstanceSendMailQmail($sendmailMode, $binaryParam | |
$this->assertEquals($sendmail, self::invokePrivate($this->mailer, 'getSendMailInstance')); | ||
} | ||
|
||
public function testGetInstanceDefault() { | ||
public function testEventForNullTransport(): void { | ||
$this->config | ||
->expects($this->exactly(1)) | ||
->method('getSystemValueString') | ||
->with('mail_smtpmode', 'smtp') | ||
->willReturn('null'); | ||
|
||
$message = $this->createMock(Message::class); | ||
$message->expects($this->once()) | ||
->method('getSymfonyEmail') | ||
->willReturn((new Email())->to("[email protected]")->from("[email protected]")->text("")); | ||
|
||
$event = new BeforeMessageSent($message); | ||
$this->dispatcher->expects($this->once()) | ||
->method('dispatchTyped') | ||
->with($this->equalTo($event)); | ||
|
||
$this->mailer->send($message); | ||
} | ||
|
||
public function testGetInstanceDefault(): void { | ||
$this->config | ||
->method('getSystemValue') | ||
->willReturnMap([ | ||
|