-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from NIAEFEUP/feature/allow-email-sending
Feature/allow email sending
- Loading branch information
Showing
12 changed files
with
1,348 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
services: | ||
website: | ||
build: | ||
context: . | ||
dockerfile: deploy/Dockerfile.website | ||
container_name: enei-website | ||
ports: | ||
- "3333:3333" | ||
|
||
website-nginx: | ||
build: | ||
context: . | ||
dockerfile: deploy/Dockerfile.nginx | ||
ports: | ||
- "80:80" |
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 |
---|---|---|
@@ -1,15 +1,7 @@ | ||
services: | ||
website: | ||
build: | ||
context: . | ||
dockerfile: deploy/Dockerfile.website | ||
container_name: enei-website | ||
mailpit: | ||
image: axllent/mailpit | ||
container_name: enei-mailpit | ||
ports: | ||
- "3333:3333" | ||
|
||
website-nginx: | ||
build: | ||
context: . | ||
dockerfile: deploy/Dockerfile.nginx | ||
ports: | ||
- "80:80" | ||
- "1025:1025" | ||
- "8025:8025" |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import env from '#start/env' | ||
import { BaseMail } from '@adonisjs/mail' | ||
|
||
export default class ExampleENotification extends BaseMail { | ||
private userEmail: string | ||
|
||
from = env.get('FROM_EMAIL') | ||
subject = 'This is an example email' | ||
|
||
constructor(userEmail: string) { | ||
super() | ||
|
||
this.userEmail = userEmail | ||
} | ||
|
||
/** | ||
* The "prepare" method is called automatically when | ||
* the email is sent or queued. | ||
*/ | ||
async prepare() { | ||
this.message | ||
.to(this.userEmail) | ||
.subject(this.subject) | ||
.htmlView('emails/example_email_html', { | ||
userEmail: this.userEmail, | ||
}) | ||
.textView('emails/example_email_text', { | ||
userEmail: this.userEmail, | ||
}) | ||
} | ||
} |
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,65 @@ | ||
import env from '#start/env' | ||
import { defineConfig, transports } from '@adonisjs/mail' | ||
|
||
const mailConfig = defineConfig({ | ||
default: 'smtp', | ||
|
||
/** | ||
* The mailers object can be used to configure multiple mailers | ||
* each using a different transport or same transport with different | ||
* options. | ||
*/ | ||
mailers: { | ||
smtp: transports.smtp({ | ||
host: env.get('SMTP_HOST'), | ||
port: env.get('SMTP_PORT'), | ||
/** | ||
* Uncomment the auth block if your SMTP | ||
* server needs authentication | ||
*/ | ||
/* auth: { | ||
type: 'login', | ||
user: env.get('SMTP_USERNAME'), | ||
pass: env.get('SMTP_PASSWORD'), | ||
}, */ | ||
}), | ||
|
||
/*ses: transports.ses({ | ||
apiVersion: '2010-12-01', | ||
region: env.get('AWS_REGION'), | ||
credentials: { | ||
accessKeyId: env.get('AWS_ACCESS_KEY_ID'), | ||
secretAccessKey: env.get('AWS_SECRET_ACCESS_KEY'), | ||
}, | ||
sendingRate: 10, | ||
maxConnections: 5, | ||
}), | ||
mailgun: transports.mailgun({ | ||
key: env.get('MAILGUN_API_KEY'), | ||
baseUrl: 'https://api.mailgun.net/v3', | ||
domain: env.get('MAILGUN_DOMAIN'), | ||
}), | ||
sparkpost: transports.sparkpost({ | ||
key: env.get('SPARKPOST_API_KEY'), | ||
baseUrl: 'https://api.sparkpost.com/api/v1', | ||
}), | ||
brevo: transports.brevo({ | ||
key: env.get('BREVO_API_KEY'), | ||
baseUrl: 'https://api.brevo.com/v3', | ||
}), | ||
resend: transports.resend({ | ||
key: env.get('RESEND_API_KEY'), | ||
baseUrl: 'https://api.resend.com', | ||
}),*/ | ||
}, | ||
}) | ||
|
||
export default mailConfig | ||
|
||
declare module '@adonisjs/mail/types' { | ||
export interface MailersList extends InferMailers<typeof mailConfig> {} | ||
} |
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
Oops, something went wrong.