Giter VIP home page Giter VIP logo

gmail's Introduction

gmail

A simple Go library for sending emails from a Gmail account.

NB: The attachment code was inspired by scorredoira's email and full credit goes to him.

package main

import "github.com/SlyMarbo/gmail"

func main() {
	email := gmail.Compose("Email subject", "Email body")
	email.From = "[email protected]"
	email.Password = "password"

	// Defaults to "text/plain; charset=utf-8" if unset.
	email.ContentType = "text/html; charset=utf-8"

	// Normally you'll only need one of these, but I thought I'd show both.
	email.AddRecipient("[email protected]")
	email.AddRecipients("[email protected]", "[email protected]")

	err := email.Send()
	if err != nil {
		// handle error.
	}
}

Note:

If you have problems with authentication, be sure to check your password settings. While developing the package, I had forgotten that I have application-specific passwords enabled on my Google account, so my account password wasn't working; I had to sign into my account and create an application-specific password for the package and use that.

gmail's People

Contributors

gquental avatar slymarbo avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

gmail's Issues

Add inbox support

The library currently only supports sending emails from a Gmail address. Ideally, I would like to add the capability to check and read emails too. However, this'll take quite a lot of work, and it's not too high on my priority list, so it's likely to take some time.

Send email using version go1.6 - Solved

The following error was occuring: "either ServerName or InsecureSkipVerify must be specified in the tls"
Thus, I changed "err = conn.StartTLS(&tls.Config{})" for
"
var tlsconfig tls.Config
tlsconfig.InsecureSkipVerify = true
err = conn.StartTLS(&tlsconfig)
"
Then, rebuild the package

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.