https://github.com/dias1c/aws-ses-bulk-emails
π§ CLI which bulk send emails on AWS SES engine
https://github.com/dias1c/aws-ses-bulk-emails
aws-letter-sender aws-sdk-go aws-ses aws-ses-bulk-emails cli golang simple-email-sender
Last synced: 6 months ago
JSON representation
π§ CLI which bulk send emails on AWS SES engine
- Host: GitHub
- URL: https://github.com/dias1c/aws-ses-bulk-emails
- Owner: Dias1c
- Created: 2023-01-14T05:10:10.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-02-02T10:34:23.000Z (8 months ago)
- Last Synced: 2025-03-31T09:39:00.774Z (6 months ago)
- Topics: aws-letter-sender, aws-sdk-go, aws-ses, aws-ses-bulk-emails, cli, golang, simple-email-sender
- Language: Go
- Homepage:
- Size: 58.6 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# aws-ses-bulk-emails
[](https://github.com/Dias1c/aws-ses-bulk-emails/releases/latest)
Bulk emails using [AWS SES](https://aws.amazon.com/ses/) with [HTML](https://pkg.go.dev/html/template)/[text](https://pkg.go.dev/text/template) templates support.
## Quick Send
1. Create `.env` from `example.env`
2. Create your template in `templates` folder
3. Prepare `data.csv`:```csv
user1@example.com
user2@example.com
```4. Run:
```bash
./aws_ses_bulk_emails --data-file="data.csv" --email-sender="sender@email.com" --subject="Subject" --tmpl-file="templates/example.html"
```> [!NOTE]
> You can run using golang. Just replace above `./aws_ses_bulk_emails` to `go run ./cmd/quick/main.go`## Advanced Usage
### Running Without Flags
You can run program without any flags
```
go run ./cmd/quick/main.go
```Required params will be taken from `data.csv` and `.env` files.
> [!TIP]
> Program supports flag `-h`
>
> ```sh
> go run ./cmd/quick/main.go -h # Show all available options
> ```### Log results
Program logs all email sending attempts to `.history.log`.
### Data File
Data file (which is .csv) that defines email settings and template variables.
> [Read about .csv file](https://en.wikipedia.org/wiki/Comma-separated_values)
Advanced `data.csv` example:
```csv
EMAIL,TEMPLATE_FILE,SUBJECT,name
example@example.com,templates/example.html,My Example subject,Dias1c
example@example.com,templates/example.txt,Text letter,MyName
example@example.com,,,
```Explaining variable keys:
| key | variable | description |
| --------------- | -------- | ------------------------------- |
| `EMAIL` | system | variable, recipient email |
| `TEMPLATE_FILE` | system | variable, path to template file |
| `SUBJECT` | system | variable, letter subject |
| `name` | user | variable |> [!NOTE]
> For the last row with empty columns, the values ββfor those columns will be taken from the `program arguments` or `env` file.#### System data Variables
System reserved variables are named with capital letters. Each system variable has its own function.
| key | type | function |
| --------------- | -------- | --------------------- |
| `EMAIL` | required | recipient email |
| `TEMPLATE_FILE` | optional | path to template file |
| `SUBJECT` | optional | letter subject |
| `SENDER_EMAIL` | optional | aws sender email |
| `SENDER_REGION` | optional | aws region |All optional variable values ββare taken from the arguments passed to the program or from the `.env` file.
Variables that are not system keys will be used as variables for templates.
### Parameters Priority
Program uses priority system to resolve conflicts when same parameter is set in multiple places:
| Priority | Source | Example |
| -------- | ------------- | ------------------------------------- |
| High | Data file | `data.csv`: SUBJECT=Welcome |
| Medium | Command flags | `--subject="Hello"` as flag on launch |
| Low | .env file | `SUBJECT=Hi` in .env |### Templates
#### HTML
```html
Welcome {{.name}}!
Your activation code {{.code}} for {{.EMAIL}}
```#### Text
```
--- {{.EMAIL}}
Dear {{.name}},
Your order #{{.orderId}} completed
```