Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1262761
email.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
984 B
Referenced Files
None
Subscribers
None
email.ts
View Options
import
assert
from
"assert"
;
import
SmtpMailer
from
"./smtp-mailer"
;
import
LoggerMailer
from
"./logger-mailer"
;
import
{
App
}
from
"../main"
;
import
Mailer
from
"./mailer"
;
import
{
Environment
}
from
"../app/config"
;
const
environment_to_mailer
:
{
[
env
in
Environment
]
:
new
(
app
:
App
)
=>
Mailer
;
}
=
{
dev
:
LoggerMailer
,
production
:
SmtpMailer
,
};
export
default
(
app
:
App
)
=>
{
let
environment
:
Environment
;
let
config
;
let
mailer
;
app
.
ConfigManager
.
setDefault
(
"email"
,
{
from_name
:
"Noreply"
,
from_address
:
"example@example.com"
,
});
app
.
ConfigManager
.
setDefault
(
"smtp"
,
SmtpMailer
.
default_config
);
config
=
app
.
ConfigManager
.
get
(
"email"
);
assert
(
typeof
config
.
from_name
===
"string"
);
assert
(
typeof
config
.
from_address
===
"string"
,
"Please set a config value for 'email.from_address'"
);
environment
=
app
.
ConfigManager
.
get
(
"core.environment"
)
as
Environment
;
mailer
=
new
environment_to_mailer
[
environment
as
Environment
](
app
);
return
mailer
;
};
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Fri, Jan 24, 15:15 (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601616
Default Alt Text
email.ts (984 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment