Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
web-et-numerique
web-et-numerique-internet
data.grandlyon.com
web-portal
components
services
mailer
Commits
56572e3f
Commit
56572e3f
authored
Jun 26, 2019
by
Fabien Forestier
Browse files
Merge branch 'development' into 'master'
Version 1.2.2 See merge request refonte-data/service-email!4
parents
b62b9c04
6538023d
Pipeline
#2443
passed with stage
in 7 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
package.json
View file @
56572e3f
{
{
"name"
:
"service-email"
,
"name"
:
"service-email"
,
"version"
:
"1.2.
1
"
,
"version"
:
"1.2.
2
"
,
"description"
:
"description"
,
"description"
:
"description"
,
"author"
:
""
,
"author"
:
""
,
"license"
:
"
MIT
"
,
"license"
:
"
MIT
"
,
...
...
src/email/email.service.ts
View file @
56572e3f
...
@@ -106,14 +106,14 @@ export class EmailService {
...
@@ -106,14 +106,14 @@ export class EmailService {
const
transporter
=
Nodemailer
.
createTransport
(
this
.
config
.
smtpConfig
);
const
transporter
=
Nodemailer
.
createTransport
(
this
.
config
.
smtpConfig
);
await
transporter
.
verify
().
catch
((
error
)
=>
{
await
transporter
.
verify
().
catch
((
error
)
=>
{
this
.
logger
.
error
(
'
SMTP connection failed.
'
,
error
,
`
${
EmailService
.
name
}
-
${
this
.
send
.
name
}
`
);
this
.
logger
.
error
(
'
SMTP connection failed.
'
,
`
${
error
}
`
,
`
${
EmailService
.
name
}
-
${
this
.
send
.
name
}
`
);
throw
new
InternalServerErrorException
({
error
,
message
:
'
SMTP connection failed.
'
});
throw
new
InternalServerErrorException
({
error
,
message
:
'
SMTP connection failed.
'
});
});
});
this
.
logger
.
log
(
'
SMTP Server is ready to receive messages
'
,
`
${
EmailService
.
name
}
-
${
this
.
send
.
name
}
`
);
this
.
logger
.
log
(
'
SMTP Server is ready to receive messages
'
,
`
${
EmailService
.
name
}
-
${
this
.
send
.
name
}
`
);
await
transporter
.
sendMail
(
email
).
catch
((
error
)
=>
{
await
transporter
.
sendMail
(
email
).
catch
((
error
)
=>
{
this
.
logger
.
error
(
'
Couldn
\'
t send email.
'
,
error
,
`
${
EmailService
.
name
}
-
${
this
.
send
.
name
}
`
);
this
.
logger
.
error
(
'
Couldn
\'
t send email.
'
,
`
${
error
}
`
,
`
${
EmailService
.
name
}
-
${
this
.
send
.
name
}
`
);
transporter
.
close
();
transporter
.
close
();
throw
new
InternalServerErrorException
({
error
,
message
:
'
Couldn
\'
t send email.
'
});
throw
new
InternalServerErrorException
({
error
,
message
:
'
Couldn
\'
t send email.
'
});
});
});
...
...
src/health/smtp.healthIndicator.ts
View file @
56572e3f
...
@@ -22,7 +22,7 @@ export class SmtpHealthIndicator extends HealthIndicator {
...
@@ -22,7 +22,7 @@ export class SmtpHealthIndicator extends HealthIndicator {
const
transporter
=
Nodemailer
.
createTransport
(
this
.
configService
.
config
.
smtpConfig
);
const
transporter
=
Nodemailer
.
createTransport
(
this
.
configService
.
config
.
smtpConfig
);
await
transporter
.
verify
().
catch
((
error
)
=>
{
await
transporter
.
verify
().
catch
((
error
)
=>
{
this
.
logger
.
error
(
'
SMTP connection failed.
'
,
error
,
`
${
SmtpHealthIndicator
.
name
}
-
${
this
.
checkSMTPConnection
.
name
}
`
);
this
.
logger
.
error
(
'
SMTP connection failed.
'
,
`
${
error
}
`
,
`
${
SmtpHealthIndicator
.
name
}
-
${
this
.
checkSMTPConnection
.
name
}
`
);
transporter
.
close
();
transporter
.
close
();
throw
new
HealthCheckError
(
'
SMTP connection failed
'
,
error
);
throw
new
HealthCheckError
(
'
SMTP connection failed
'
,
error
);
});
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment