postmark-sender

command module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

README

PaySuper Postmark Sender

contributions welcome Build Status codecov Go Report Card

PaySuper Postmark Sender is a RabbitMQ consumer to send emails using the Postmark Service.


Table of Contents

Usage

package main

import (
    postmarkPb "github.com/paysuper/paysuper-proto/go/postmarkpb"
    postmarkPkg "github.com/paysuper/postmark-sender/pkg"
    "github.com/streadway/amqp"
    "gopkg.in/ProtocolONE/rabbitmq.v1/pkg"
    "log"
)

func main()  {
    broker, err := rabbitmq.NewBroker("amqp://127.0.0.1:5672")
    
    if err != nil {
        log.Fatalf("Creating RabbitMQ publisher failed with error: %s\n", err)
    }
    
    payload := &postmarkPb.Payload{
        TemplateAlias: "template_name",
        TemplateModel: map[string]string{"param1": "value1"},
        To:            "emai@test.com",
    }
    
    err = broker.Publish(postmarkPkg.PostmarkSenderTopicName, payload, amqp.Table{})
    
    if err != nil {
        log.Fatalf("Publication message to queue failed with error: %s\n", err)
    }
}
Environment variables:

The application handles all configuration from the environment variables.

Name Required Default Description
BROKER_ADDRESS - amqp://127.0.0.1:5672 The RabbitMQ URL address.
POSTMARK_API_URL - https://api.postmarkapp.com/email/withTemplate The Postmark API URL.
POSTMARK_API_TOKEN true - The Postmark API security token.
POSTMARK_EMAIL_FROM true - The sender email to send emails to users.
POSTMARK_EMAIL_CC - "" The CC recipient email address. Multiple addresses are comma separated. Max 50.
POSTMARK_EMAIL_BCC - "" The BCC recipient email address. Multiple addresses are comma separated. Max 50.
POSTMARK_EMAIL_TRACK_OPENS - false Activate the open tracking for all emails.
POSTMARK_EMAIL_TRACK_LINKS - "" Activate the link tracking for links in the HTML or Text bodies of this email. Possible options: None, HtmlAndText, HtmlOnly, TextOnly.

Contributing, Feature Requests and Support

If you like this project then you can put a ⭐ on it. It means a lot to us.

If you have an idea of how to improve PaySuper (or any of the product parts) or have general feedback, you're welcome to submit a feature request.

Chances are, you like what we have already but you may require a custom integration, a special license or something else big and specific to your needs. We're generally open to such conversations.

If you have a question and can't find the answer yourself, you can raise an issue and describe what exactly you're trying to do. We'll do our best to reply in a meaningful time.

We feel that a welcoming community is important and we ask that you follow PaySuper's Open Source Code of Conduct in all interactions with the community.

PaySuper welcomes contributions from anyone and everyone. Please refer to our contribution guide to learn more.

License

The project is available as open source under the terms of the GPL v3 License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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