Email Configuration
Overview
THT uses SMTP to send email through a third-party email sending service.
You will need to register with a third-party mail sender in order to ensure that your messages are delivered reliably.
Steps:
- Sign up for a mail sending service
- Verify your sender address
- Update your THT email config
- Set your password
Step 1: Sign Up for an Email Sender
Many mail sender services have free tiers that allow you to send a few hundred emails per month at no charge.
Recommended services:
SMTP vs REST
Some services have two ways to access their API: REST and SMTP.
We recommend SMTP, as it will be easier to set up and use. However, if you need to call their REST API directly, you can use the Net module.
Step 2: Verify Your Sender Address
Most services require you to verify the email address you will be sending from.
This usually requires clicking on a verification link in an email they send to your sender address.
Step 3. Update THT Config
Update your email
config in config/app.local.jcon
.
Example:
email: { host: smtp.sendgrid.net port: 587 user: apikey password: abc123... }
Next Steps
You may now send emails using the built-in Email module.
Example:
Email.send({ from: 'you@yoursite.com' fromName: 'Yoursite Admin' to: 'user@email.com' subject: 'Welcome!' body: html''' Thanks for joining! Here is a <a href="...">helpful link.</a> ''' })