Giter VIP home page Giter VIP logo

gomailer's Introduction

Package gomailer

Go Report Card GoDoc License

This package provides a simple email interface to integrate third party email services. You can integrate popular email services and switch easily.

Installation

Install the package using

$ go get github.com/thedevsaddam/gomailer

Usage

To use the package import it in your *.go code

import "github.com/thedevsaddam/gomailer"

Integration

package main

import (
	"log"

	mailer "github.com/thedevsaddam/gomailer"
)

func main() {
	c := mailer.Configs{
		Domain: "Your domain here",
		APIKey: "Your key here",
	}

	m, err := mailer.New(mailer.MAILGUN, c)
	checkError(err)

	m.From("John Doe", "[email protected]")
	m.To("Jane Doe", "[email protected]")
	m.Cc("Tom", "[email protected]")
	m.Bcc("Jerry", "[email protected]")
  	m.ReplyTo("Salman", "[email protected]")
	m.Subject("mailgun: Urgent email about tom & jerry")
	// m.BodyText("This is a test text email")
	m.BodyHTML("<html>Inline image here: <img src='cid:a.jpg'></html>")
	m.AttachmentFile("a.jpg")

	checkError(err)
	err = m.Send()
	checkError(err)
}

func checkError(err error) {
	if err != nil {
		log.Println(err)
	}
}

You can chain methods easily

m, err := mailer.New(mailer.MAILGUN, c)
m.To("name", "email").Cc("name", "email").Bcc("name", "email").Bcc("name", "email").Subject("Your subject").BodyText("simple message here").AttachmentFile("some/file.zip").Send()

Roadmap

  • Mailgun
  • Sendgrid
  • Postmark
  • Mailjet
  • CustomerIO
  • Elasticmail
  • Jangomail
  • Leadersend
  • Madmimi
  • Mandrill
  • Postageapp
  • Socketlabs
  • Sparkpost

Note

This package is under development, need to write tests, unimplemented services. Use now at your own risk.

Contribution

Your suggestions will be more than appreciated. Read the contribution guide here

See all contributors

Read API doc to know about Available options and Methods

License

The gomailer is an open-source software licensed under the MIT License.

gomailer's People

Contributors

anondo avatar thedevsaddam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dungna wkoe anondo

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.