diff options
Diffstat (limited to 'config/mail.ts')
-rw-r--r-- | config/mail.ts | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/config/mail.ts b/config/mail.ts new file mode 100644 index 0000000..1210592 --- /dev/null +++ b/config/mail.ts | |||
@@ -0,0 +1,118 @@ | |||
1 | /** | ||
2 | * Config source: https://git.io/JvgAf | ||
3 | * | ||
4 | * Feel free to let us know via PR, if you find something broken in this contract | ||
5 | * file. | ||
6 | */ | ||
7 | |||
8 | import Env from '@ioc:Adonis/Core/Env'; | ||
9 | import { mailConfig } from '@adonisjs/mail/build/config'; | ||
10 | |||
11 | export default mailConfig({ | ||
12 | /* | ||
13 | |-------------------------------------------------------------------------- | ||
14 | | Default mailer | ||
15 | |-------------------------------------------------------------------------- | ||
16 | | | ||
17 | | The following mailer will be used to send emails, when you don't specify | ||
18 | | a mailer | ||
19 | | | ||
20 | */ | ||
21 | mailer: 'smtp', | ||
22 | |||
23 | /* | ||
24 | |-------------------------------------------------------------------------- | ||
25 | | Mailers | ||
26 | |-------------------------------------------------------------------------- | ||
27 | | | ||
28 | | You can define or more mailers to send emails from your application. A | ||
29 | | single `driver` can be used to define multiple mailers with different | ||
30 | | config. | ||
31 | | | ||
32 | | For example: Postmark driver can be used to have different mailers for | ||
33 | | sending transactional and promotional emails | ||
34 | | | ||
35 | */ | ||
36 | mailers: { | ||
37 | /* | ||
38 | |-------------------------------------------------------------------------- | ||
39 | | Smtp | ||
40 | |-------------------------------------------------------------------------- | ||
41 | | | ||
42 | | Uses SMTP protocol for sending email | ||
43 | | | ||
44 | */ | ||
45 | smtp: { | ||
46 | driver: 'smtp', | ||
47 | name: Env.get('APP_URL'), | ||
48 | port: Env.get('SMTP_PORT', '2525'), | ||
49 | host: Env.get('SMTP_HOST', 'localhost'), | ||
50 | secure: JSON.parse(Env.get('MAIL_SSL', 'false')), | ||
51 | requireTLS: JSON.parse(Env.get('MAIL_REQUIRE_TLS', 'false')), | ||
52 | auth: { | ||
53 | user: Env.get('SMTP_USERNAME'), | ||
54 | pass: Env.get('SMTP_PASSWORD'), | ||
55 | type: 'login', | ||
56 | }, | ||
57 | maxConnections: 5, | ||
58 | maxMessages: 100, | ||
59 | rateLimit: 10, | ||
60 | }, | ||
61 | |||
62 | /* | ||
63 | |-------------------------------------------------------------------------- | ||
64 | | SES | ||
65 | |-------------------------------------------------------------------------- | ||
66 | | | ||
67 | | Uses Amazon SES for sending emails. You will have to install the aws-sdk | ||
68 | | when using this driver. | ||
69 | | | ||
70 | | ``` | ||
71 | | npm i aws-sdk | ||
72 | | ``` | ||
73 | | | ||
74 | */ | ||
75 | ses: { | ||
76 | driver: 'ses', | ||
77 | apiVersion: '2010-12-01', | ||
78 | key: Env.get('SES_ACCESS_KEY'), | ||
79 | secret: Env.get('SES_ACCESS_SECRET'), | ||
80 | region: Env.get('SES_REGION'), | ||
81 | sslEnabled: true, | ||
82 | sendingRate: 10, | ||
83 | maxConnections: 5, | ||
84 | }, | ||
85 | |||
86 | /* | ||
87 | |-------------------------------------------------------------------------- | ||
88 | | Mailgun | ||
89 | |-------------------------------------------------------------------------- | ||
90 | | | ||
91 | | Uses Mailgun service for sending emails. | ||
92 | | | ||
93 | | If you are using an EU domain. Ensure to change the baseUrl to hit the | ||
94 | | europe endpoint (https://api.eu.mailgun.net/v3). | ||
95 | | | ||
96 | */ | ||
97 | mailgun: { | ||
98 | driver: 'mailgun', | ||
99 | baseUrl: 'https://api.mailgun.net/v3', | ||
100 | key: Env.get('MAILGUN_API_KEY'), | ||
101 | domain: Env.get('MAILGUN_DOMAIN'), | ||
102 | }, | ||
103 | |||
104 | /* | ||
105 | |-------------------------------------------------------------------------- | ||
106 | | SparkPost | ||
107 | |-------------------------------------------------------------------------- | ||
108 | | | ||
109 | | Uses Sparkpost service for sending emails. | ||
110 | | | ||
111 | */ | ||
112 | sparkpost: { | ||
113 | driver: 'sparkpost', | ||
114 | baseUrl: 'https://api.sparkpost.com/api/v1', | ||
115 | key: Env.get('SPARKPOST_API_KEY'), | ||
116 | }, | ||
117 | }, | ||
118 | }); | ||