Skip to content

Commit

Permalink
[#21] Route all email through Mailpit
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuapease committed May 28, 2024
1 parent 17378fb commit 7ba2dbe
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .ddev/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ database:
version: '8.0'
use_dns_when_possible: true
composer_version: '2'
web_environment: []
web_environment:
# Use Mailpit
- SYSTEM_EMAIL_HOSTNAME=localhost
- SYSTEM_EMAIL_PORT=1025
- SYSTEM_EMAIL_USERNAME=abc
- SYSTEM_EMAIL_PASSWORD=123
nodejs_version: '18'
hooks:
post-start:
Expand Down
8 changes: 8 additions & 0 deletions .env.example.dev
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ CRAFT_APP_ID=
# The environment Craft is currently running in (dev, staging, production, etc.)
CRAFT_ENVIRONMENT=dev

# Email
SYSTEM_EMAIL_ADDRESS=craft@viget.com
SYSTEM_EMAIL_SENDER="Craft CMS"
SYSTEM_EMAIL_HOSTNAME=
SYSTEM_EMAIL_PORT=
SYSTEM_EMAIL_USERNAME=
SYSTEM_EMAIL_PASSWORD=

# Database connection settings
CRAFT_DB_DRIVER=mysql
CRAFT_DB_SERVER=127.0.0.1
Expand Down
7 changes: 7 additions & 0 deletions .env.example.production
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ CRAFT_APP_ID=
# The environment Craft is currently running in (dev, staging, production, etc.)
CRAFT_ENVIRONMENT=production

# Email
SYSTEM_EMAIL_FROM=craft@viget.com
SYSTEM_EMAIL_HOSTNAME=
SYSTEM_EMAIL_PORT=
SYSTEM_EMAIL_USERNAME=
SYSTEM_EMAIL_PASSWORD=

# Database connection settings
CRAFT_DB_DRIVER=mysql
CRAFT_DB_SERVER=127.0.0.1
Expand Down
7 changes: 7 additions & 0 deletions .env.example.staging
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ CRAFT_APP_ID=
# The environment Craft is currently running in (dev, staging, production, etc.)
CRAFT_ENVIRONMENT=staging

# Email
SYSTEM_EMAIL_FROM=craft@viget.com
SYSTEM_EMAIL_HOSTNAME=
SYSTEM_EMAIL_PORT=
SYSTEM_EMAIL_USERNAME=
SYSTEM_EMAIL_PASSWORD=

# Database connection settings
CRAFT_DB_DRIVER=mysql
CRAFT_DB_SERVER=127.0.0.1
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
# Getting Started
# Viget's Craft CMS Starter

This repo is a Composer "project" intended for use with the `composer create-project` command.

Our starter uses DDEV for local development. Install it before doing any of the following steps.

# Features

- Local development [powered by DDEV](https://ddev.com/)
- [Vite](https://vitejs.dev/) based front-end build tooling.
- Automatic linting, formatting and typechecking
- Runs on git pre-commit hook with [Husky](https://typicode.github.io/husky/)
- Only processes staged files using [lint-staged](https://github.com/lint-staged/lint-staged)
- [Prettier](https://prettier.io/), [eslint](https://eslint.org/), [PHPStan](https://github.com/craftcms/phpstan), [PHP
Easy Coding Standard](https://github.com/craftcms/ecs)
- Common plugins come pre-installed
- Local email is routed
through [Mailpit](https://ddev.readthedocs.io/en/stable/users/usage/developer-tools/#email-capture-and-review-mailpit) (
never worry about emailing a client or user)

# Getting Started

## Create Project

1. [Install DDEV](https://ddev.readthedocs.io/en/stable/users/install/ddev-installation/)
Expand Down
14 changes: 11 additions & 3 deletions config/project/project.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
dateModified: 1716567262
dateModified: 1716568939
email:
fromEmail: joshua.pease@viget.com
fromEmail: $SYSTEM_EMAIL_FROM
fromName: 'Viget Craft Starter'
transportType: craft\mail\transportadapters\Sendmail
replyToEmail: null
template: null
transportSettings:
host: $SYSTEM_EMAIL_HOSTNAME
password: $SYSTEM_EMAIL_PASSWORD
port: $SYSTEM_EMAIL_PORT
useAuthentication: '1'
username: $SYSTEM_EMAIL_USERNAME
transportType: craft\mail\transportadapters\Smtp
meta:
__names__:
35b563a0-4662-40b9-b885-a8450a2868d9: 'Viget Craft Starter' # Viget Craft Starter
Expand Down

0 comments on commit 7ba2dbe

Please sign in to comment.