Code Monkey home page Code Monkey logo

one-off-email's Introduction

one-off-email

About

Send a one-off email to a provided recipient list.

Requirements

  • Golang 1.18

Running Locally

Create config files

From the project root...

Create env file:

cp data/.env.example data/.env

Amend env values so that they reflect the following:

  • MAILGUN_API_KEY = API key registered within Mailgun
  • MAILGUN_SENDER_DOMAIN = Sender domain configured within Mailgun
  • SENDER_NAME = Sender's name to issue the email from
  • SENDER_EMAIL = Sender's email address to issue the email from
  • REPLY_TO_NAME = Name to include with Reply-To when issuing email
  • REPLY_TO_EMAIL = Email address to include as Reply-To when issuing email
  • BCC_NAME = Name to include with BCC when issuing email
  • BCC_EMAIL = Email address to include as BCC when issuing email
  • EMAIL_SUBJECT = Subject to use when sending emails️
  • MESSAGE_SIGN_OFF = Sign-off name within email message

Create message templates:

cp data/templates/example.message.html data/templates/message.html
cp data/templates/example.message.txt data/templates/message.txt

Change the template names of each new file respectively:

data/templates/message.html

-{{define "example_message_html"}}
+{{define "message_html"}}
data/templates/message.txt

-{{define "example_message_txt"}}
+{{define "message_txt"}}

Create recipients file:

cp data/recipients.example.yml data/recipients.yml

Amend new recipients file, ensuring that contents are valid YAML and retain the same .name and .email format per recipient.

Run in preview mode

From the project root...

go run main.go

...then visit the following pages in your web browser to preview the templates:

Run and send emails

From the project root...

go run main.go -send

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.