Code Monkey home page Code Monkey logo

sendgrid-go's Introduction

sendgrid-go

A wrapper around sendgrid/sendgrid-go library to consume the api easily and help you remove the boiler plate around using its personalizations feature.

install the package

run go get github.com/vikashvikram/sendgrid-go

example

Following example will send mail to list of participant specified in to with subject Test Mail and plain text content This is a test mail.

package main

import (
	"fmt"

	"github.com/vikashvikram/sendgrid-go"
)

func main() {
	from := "[email protected]"
	to := []string{"[email protected]", "[email protected]"}
	subject := "Test Mail"
	body := "This is a test mail"
	response, err := sendgrid.Mail(from, subject, to, body)
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println(response.StatusCode)
		fmt.Println(response.Body)
		fmt.Println(response.Headers)
	}
}

Please Note

  1. please make sure that SENDGRID_API_KEY env variable exists with valid values. In case you do not have it, please generate one from sendgrid website
  2. Sometimes you receive mails in your junk box so please don't forget to check mails there. In such cases, you will need to tell your email service that this is not a junk mail, so that in future you receive mails sent from sendgrid in your inbox.

sendgrid-go's People

Contributors

vikashvikram avatar

Watchers

James Cloos avatar  avatar

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.