-
Notifications
You must be signed in to change notification settings - Fork 3
Smtp mailing service #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
HunteRoi
wants to merge
11
commits into
master
Choose a base branch
from
smtp-mailing-service
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Smtp mailing service #107
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ac46c1b
feat: use SMTP instead of 3rd party service
12829f6
fix: log errors from Discord websocket
c951c7f
fix: migrations runned at container mount
5caba20
fix: fix config for SMTP & adapt mail content
ae9033c
fix: clean up and check runtime
4de0c3b
style: flatten after rebase
2951139
style: lint after rebase
a963cd3
chore: increment patch version
62fc5d3
fix: getErrorMessage not imported
4eaa199
fix: quality gate issues, linting, nodemailer security issue
dbf433d
docs: add extensions recommendations
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -144,9 +144,12 @@ | |
| "emote": "📢" | ||
| }, | ||
| "communicationServiceOptions": { | ||
| "mailData": { | ||
| "from": "[email protected]", | ||
| "templateId": "9131196" | ||
| } | ||
| "from": "[email protected]", | ||
| "port": 587, | ||
| "host": "smtp.ethereal.email", | ||
| "secure": false, | ||
| "service": "Ethereal", | ||
| "debug": true, | ||
| "logger": true | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -156,9 +156,10 @@ | |
| "emote": "📢" | ||
| }, | ||
| "communicationServiceOptions": { | ||
| "mailData": { | ||
| "from": "[email protected]", | ||
| "templateId": "9131196" | ||
| } | ||
| "from": "[email protected]", | ||
| "host": "smtp.office365.com", | ||
| "port": 587, | ||
| "secure": true, | ||
| "service": "Outlook365" | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,7 @@ | ||
| import type { DatadropClient } from "../datadrop.js"; | ||
|
|
||
| export default async function error(client: DatadropClient, error: Error) { | ||
| client.logger.error( | ||
| `${error.name}: ${error.message}\n${error.cause}\n${error.stack}`, | ||
| ); | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,11 @@ | ||
| export { Command } from "./Command.js"; | ||
| export { | ||
| AnnounceConfiguration, | ||
| Configuration, | ||
| GroupConfiguration, | ||
| SpecialRoleConfiguration, | ||
| YearConfiguration, | ||
| } from "./Configuration.js"; | ||
| export { Event } from "./Event.js"; | ||
| export { IDatabaseService } from "./IDatabaseService.js"; | ||
| export { User } from "./User.js"; |
This file contains hidden or 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 hidden or 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,26 @@ | ||
| import type { ISenderAPI, SenderAPIData } from "@hunteroi/discord-verification"; | ||
| import { createTransport, getTestMessageUrl } from "nodemailer"; | ||
| import type SMTPTransport from "nodemailer/lib/smtp-transport/index.js"; | ||
|
|
||
| export type SMTPServiceOptions = SMTPTransport.Options; | ||
|
|
||
| export class SMTPService implements ISenderAPI { | ||
| readonly #options: SMTPServiceOptions; | ||
|
|
||
| constructor(options: SMTPServiceOptions) { | ||
| this.#options = options; | ||
| } | ||
|
|
||
| async send({ name, code, ...data }: SenderAPIData): Promise<void> { | ||
| const transporter = createTransport(this.#options); | ||
| await transporter.verify(); | ||
| const result = await transporter.sendMail({ | ||
| from: this.#options.from, | ||
| to: data.to, | ||
| subject: "Code d'Authentification Discord", | ||
| text: `Hello ${name}! Ton code est ${code}. A plus tard o/`, | ||
| html: `<p>Hello ${name}!</p><p>Ton code est ${code}.</p><p>A plus tard o/</p>`, | ||
| }); | ||
| console.debug("Preview URL: %s", getTestMessageUrl(result)); | ||
| } | ||
| } |
This file contains hidden or 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,2 @@ | ||
| export { PostgresDatabaseService } from "./PostgresDatabaseService.js"; | ||
| export { SMTPService } from "./SMTPService.js"; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.