mailgunsmtphandler

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 20 Imported by: 0

README

GO Mailio Mailgun SMTP Handler

GO handler of SMTP emails in Mailio server

Install

go get github.com/mailio/go-mailio-mailgun-smtp-handler

Features

  • Send SMTP message
  • Received SMTP messages for specific domain
  • Plugin module for Mailio server

Testing

See CONTRIBUTING.md for setup instructions.

Supported Go Versions

Go 1.20 and higher

Status

This package is currently under development mode, which means:

  1. It's under active development and NOT battle tested yet
  2. It does accept bug fixes and version compatability changes provided by the community.
  3. Community members are encouraged to help each other with reported issues.

Documentation

Index

Constants

View Source
const MaxNumberOfRecipients = 20

Variables

This section is empty.

Functions

func VerifyWebhookSignature added in v1.0.2

func VerifyWebhookSignature(sig mailgun.Signature, webhookApiKey string) (verified bool, err error)

VerifyWebhookSignature is a modified method from mailgun that supports a webhook key, intead of sending api key

Types

type Domains added in v1.0.4

type Domains struct {
	TotalCount int `json:"total_count"`
	Items      []struct {
		CreatedAt string `json:"created_at"`
		ID        string `json:"id"`
		Name      string `json:"name"`
		State     string `json:"state"`
		WebPrefix string `json:"web_prefix"`
		Type      string `json:"type"`
		Disabled  struct {
			Code        string `json:"code"`
			Note        string `json:"note"`
			Permanently bool   `json:"permanently"`
			Reason      string `json:"reason"`
		} `json:"disabled"`
	} `json:"items"`
}

type MailgunSmtpHandler

type MailgunSmtpHandler struct {
	// contains filtered or unexported fields
}

func NewMailgunSmtpHandler

func NewMailgunSmtpHandler(webhookSigningKey string, developmentApiKey string, baseURL *string) *MailgunSmtpHandler

NewMailgunSmtpHandler creates a new Mailgun SMTP handler with the specified webhook signing key and optional base URL. If the base URL is not provided, it defaults to "https://api.mailgun.net/v3".

Parameters:

  • webhookSigningKey: The signing key used for validating webhook requests for incoming emails.
  • developmentApiKey: The API key used for sending emails from the development domain.
  • baseURL: A pointer to a string specifying the base URL for the Mailgun API. If nil, the default URL is used.

Returns:

  • A new instance of MailgunSmtpHandler that implements the mailioutil.SmtpHandler interface.

func (*MailgunSmtpHandler) ListDomains added in v1.0.4

func (m *MailgunSmtpHandler) ListDomains() ([]string, error)

list all supported domains

func (*MailgunSmtpHandler) ReceiveMail

func (m *MailgunSmtpHandler) ReceiveMail(request http.Request) (*mailiotypes.Mail, error)

* Note: To receive raw MIME messages and perform your own parsing, you must configure a route with a URL ending with "mime". Example: http://myhost/post_mime

func (*MailgunSmtpHandler) SendMimeMail

func (m *MailgunSmtpHandler) SendMimeMail(from mail.Address, raw []byte, to []mail.Address) (string, error)

send mail using mailgun

func (*MailgunSmtpHandler) SetDomainAndSendApiKey added in v1.0.4

func (m *MailgunSmtpHandler) SetDomainAndSendApiKey(key string, domain string) error

associates the domain with the sending api key

Jump to

Keyboard shortcuts

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