-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MailService getDefaultMailFrom() #10475
- Loading branch information
1 parent
14b7f0e
commit 27d5cb3
Showing
7 changed files
with
97 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
25 changes: 25 additions & 0 deletions
25
modules/lib/lib-mail/src/main/java/com/enonic/xp/lib/mail/GetDefaultFromEmailHandler.java
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.enonic.xp.lib.mail; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import com.enonic.xp.mail.MailService; | ||
import com.enonic.xp.script.bean.BeanContext; | ||
import com.enonic.xp.script.bean.ScriptBean; | ||
|
||
public class GetDefaultFromEmailHandler | ||
implements ScriptBean | ||
{ | ||
|
||
private Supplier<MailService> mailService; | ||
|
||
@Override | ||
public void initialize( final BeanContext context ) | ||
{ | ||
this.mailService = context.getService( MailService.class ); | ||
} | ||
|
||
public String execute() | ||
{ | ||
return this.mailService.get().getDefaultFromEmail(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
modules/lib/lib-mail/src/main/resources/lib/xp/examples/mail/getDefaultFromEmail.js
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var mailLib = require('/lib/xp/mail.js'); | ||
var assert = require('/lib/xp/testing.js'); | ||
|
||
// BEGIN | ||
// Retrieve the default from mail address. | ||
var defaultFromEmail = mailLib.getDefaultFromEmail(); | ||
// END | ||
|
||
assert.assertEquals('noreply@domain.com', defaultFromEmail); |
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