Skip to content

Commit

Permalink
feat: catch emails sent locally using Mailhog (calcom#8470)
Browse files Browse the repository at this point in the history
* feat: added mailhog to catch emails sent locally

* fix: added new line at the end of packages/emails/docker-compose.yml

* chore: removed EMAIL_SERVER_USER and EMAIL_SERVER_PASSWORD for local usage with Mailhog

---------

Co-authored-by: Keith Williams <keithwillcode@gmail.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
  • Loading branch information
3 people committed May 6, 2023
1 parent c6ab889 commit 3c46c39
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,16 @@ API_KEY_PREFIX=cal_
EMAIL_FROM='notifications@yourselfhostedcal.com'

# Configure SMTP settings (@see https://nodemailer.com/smtp/).
# Configuration to receive emails locally (mailhog)
EMAIL_SERVER_HOST='localhost'
EMAIL_SERVER_PORT=1025

# Note: The below configuration for Office 365 has been verified to work.
EMAIL_SERVER_HOST='smtp.office365.com'
EMAIL_SERVER_PORT=587
EMAIL_SERVER_USER='<office365_emailAddress>'
# EMAIL_SERVER_HOST='smtp.office365.com'
# EMAIL_SERVER_PORT=587
# EMAIL_SERVER_USER='<office365_emailAddress>'
# Keep in mind that if you have 2FA enabled, you will need to provision an App Password.
EMAIL_SERVER_PASSWORD='<office365_password>'
# EMAIL_SERVER_PASSWORD='<office365_password>'

# The following configuration for Gmail has been verified to work.
# EMAIL_SERVER_HOST='smtp.gmail.com'
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ echo 'NEXT_PUBLIC_DEBUG=1' >> .env
```sh
yarn workspace @calcom/prisma db-deploy
```
1. Run [mailhog](https://github.com/mailhog/MailHog) to view emails sent during development

```sh
docker pull mailhog/mailhog
docker run -d -p 8025:8025 -p 1025:1025 mailhog/mailhog
```

1. Run (in development mode)

Expand Down
8 changes: 8 additions & 0 deletions packages/emails/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Starts mailhog SMTP server on port 1025, web interface on port 8025
version: "3.6"
services:
mailhog:
image: 'mailhog/mailhog:latest'
ports:
- "1025:1025"
- "8025:8025"
3 changes: 3 additions & 0 deletions packages/emails/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"sideEffects": false,
"version": "0.0.0",
"private": true,
"scripts": {
"dx": "docker compose up -d"
},
"dependencies": {
"@calcom/dayjs": "*",
"@calcom/lib": "*",
Expand Down

0 comments on commit 3c46c39

Please sign in to comment.