emailpub

package module
v0.0.0-...-bcb6752 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

README

emailpub

emailpub is a Google Cloud Platform Cloud Function. It gets triggered by messages published to a Pub/Sub topic. Each message represents an email to send.

It sends email via SMTP. The Pub/Sub messages include the subject, recipient, and text body.

I created it because I wanted to send emails from hosts where I don't want to expose SMTP credentials. With emailpub, I can give these hosts a GCP service account allowing them to publish messages to send emails.

Setup

Create env.yml:

---
SMTP_HOST: smtp.gmail.com
SMTP_PORT: '587'
SMTP_USER: ...@gmail.com
SMTP_PASS: password...

Deploy the function (also creates the Pub/Sub topic):

gcloud functions deploy EmailPub \
  --runtime go113 \
    --trigger-topic emailpub \
    --source . \
    --env-vars-file env.yml

Documentation

Overview

Package emailpub is a Cloud Function that gets triggered by Pub/Sub messages. It sends an email.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmailPub

func EmailPub(ctx context.Context, psm pubSubMessage) error

EmailPub consumes a Pub/Sub message.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL