GithubHelp home page GithubHelp logo

go-mailer's Introduction

Build Status License Releases Read me docs Build Status Built with GoLang Platforms

Simple E-mail sender for Go Programming Language.

Supports rich e-mails and ,optionally, Unix built'n sendmail command.

Installation

The only requirement is the Go Programming Language.

$ go get -u github.com/kataras/go-mailer

Docs

  • New returns a new, e-mail sender service.
  • Send send an e-mail, supports text/html and sendmail unix command
Send(subject string, body string, to ...string) error

Configuration

type Config struct {
    // Host is the server mail host, IP or address
    Host string
    // Port is the listening port
    Port int
    // Username is the auth [email protected] for the sender
    Username string
    // Password is the auth password for the sender
    Password string
    // FromAlias is the from part, if empty this is the first part before @ from the Username field
    FromAlias string
    // UseCommand enable it if you want to send e-mail with the mail command  instead of smtp
    //
    // Host,Port & Password will be ignored
    // ONLY FOR UNIX
    UseCommand bool
}

Usage

import "github.com/kataras/go-mailer"

//...

// sender configuration
config := mailer.Config{
    Host:     "smtp.mailgun.org",
    Username: "[email protected]",
    Password: "38304272b8ee5c176d5961dc155b2417",
    Port:     587,
    UseCommand:false,
    // Enable UseCommand to support sendmail unix command, if this field is true then Host, Username, Password and Port are not required, because these info already exists in your local sendmail configuration
}

// initalize a new mail sender service
sender := mailer.New(config)

// the subject/title of the e-mail
subject := "Hello subject"

// the rich message body
content := `<h1>Hello</h1> <br/><br/> <span style="color:red"> This is the rich message body </span>`

// the recipient(s)
to := []string{"[email protected]", "[email protected]"}


// Send the e-mail
err := mailer.Send(subject, content, to...)

if err != nil {
  println("Error while sending the e-mail. Trace: "+err.Error())
}

go-* packages

Name Description
go-errors Error handling
go-fs FileSystem utils and common net/http static files handlers
go-events EventEmmiter for Go
go-installer Download & Install remote zipped files
go-websocket A websocket server and ,optionally, client side lib for Go
go-ssh SSH Server, build ssh interfaces, remote commands and remote cli with ease
go-gzipwriter Write gzip data to a io.Writer
rizla Monitor and live-reload of your Go App
Q HTTP2 Web Framework, 100% compatible with net/http
Iris The fastest web framework. Built on top of fasthttp

FAQ

Explore these questions or navigate to the community chat.

Versioning

Current: v0.0.1

People

The author of go-mailer is @kataras.

If you're willing to donate, feel free to send any amount through paypal

Contributing

If you are interested in contributing to the go-mailer project, please make a PR.

License

This project is licensed under the MIT License.

License can be found here.

go-mailer's People

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.