<commit_before>#SendGrid-Go

SendGrid Helper Library to send emails very easily using Go.

##Installation

```bash
go get github.com/elbuo8/sendgrid-go/sendgrid
```

##Example

```Go
package main

import (
	"fmt"
	"net/mail"
	"github.com/elbuo8/sendgrid-go/sendgrid"
)

func main() {
	sg := sendgrid.NewSendGridClient("sendgrid_user", "sendgrid_key")
	message := sendgrid.NewMail()
	message.AddTo("<EMAIL>")
	message.AddToName("<NAME>")
	message.AddTo("<NAME> <<EMAIL>>")
	address, _ := mail.ParseAddress("<NAME> <<EMAIL>>")
	message.AddReceipient(address)
	message.AddSubject("SendGrid Testing")
	message.AddHTML("WIN")
	message.AddFrom("<EMAIL>")
	message.AddHeader("X-Mailer", "Test")
	message.AddAttachment("filepath]")
    message.AddHeader("X-Mailer", "Test")
    if r := sg.Send(message); r == nil {
		fmt.Println("Email sent!")
	} else {
		fmt.Println(r)
	}
	/*
	Additional ways to interface with the client
	sg.SendAPI(message)
	sg.SendSMTP(message)
	*/
}

```

##AppEngine Example

```Go
package main

import (
	"fmt"
	"appengine/urlfetch"
	"github.com/elbuo8/sendgrid-go/sendgrid"
)

func handler(w http.ResponseWriter, r *http.Request) {
	sg := sendgrid.NewSendGridClient("sendgrid_user", "sendgrid_key")
	c := appengine.NewContext(r)
	// set http.Client to use the appengine client
	sg.Client = urlfetch.Client(c)
	message := sendgrid.NewMail()
	message.AddTo("<EMAIL>")
	message.AddToName("<NAME>")
	message.AddSubject("SendGrid is Baller")
	message.AddHTML("Simple Text")
	message.AddFrom("<EMAIL>")
	// use sendAPI instead of SMTP
	if r := sg.SendAPI(message); r == nil {
		fmt.Println("Email sent!")
	} else {
		c.Errorf("Unable to send mail %v",r)
	}
}

```


###Notes

SMTP has been added has a fallback. Basically invoking **Send** will call **SendAPI**. If that fails, **SendSMTP** will be invoked as a fallback. SMTP is still missing a few features; therefore it is recommended that **SendAPI** & **Send** are the primary methods.


###TODO

* Finish implementing SMTP
* Implement additional API endpoints

##MIT License

Enjoy. Feel free to make pull requests :)
<commit_msg>Added some more info<commit_after>#SendGrid-Go

SendGrid Helper Library to send emails very easily using Go.

##Installation

```bash
go get github.com/elbuo8/sendgrid-go/sendgrid
```

##Example

```Go
package main

import (
	"fmt"
	"net/mail"
	"github.com/elbuo8/sendgrid-go/sendgrid"
)

func main() {
	sg := sendgrid.NewSendGridClient("sendgrid_user", "sendgrid_key")
	message := sendgrid.NewMail()
	message.AddTo("<EMAIL>")
	message.AddToName("<NAME>")
	message.AddTo("<NAME> <<EMAIL>>")
	address, _ := mail.ParseAddress("<NAME> <<EMAIL>>")
	message.AddReceipient(address)
	message.AddReceipientBCC(address)
	message.AddBCC("<EMAIL>")
	message.AddSubject("SendGrid Testing")
	message.AddHTML("WIN")
	message.AddFrom("<EMAIL>")
	message.AddHeader("X-Mailer", "Test")
	message.AddAttachment("filepath]")
    message.AddHeader("X-Mailer", "Test")
    if r := sg.Send(message); r == nil {
		fmt.Println("Email sent!")
	} else {
		fmt.Println(r)
	}
	/*
	Additional ways to interface with the client
	sg.SendAPI(message)
	sg.SendSMTP(message)
	*/
}

```

##AppEngine Example

```Go
package main

import (
	"fmt"
	"appengine/urlfetch"
	"github.com/elbuo8/sendgrid-go/sendgrid"
)

func handler(w http.ResponseWriter, r *http.Request) {
	sg := sendgrid.NewSendGridClient("sendgrid_user", "sendgrid_key")
	c := appengine.NewContext(r)
	// set http.Client to use the appengine client
	sg.Client = urlfetch.Client(c)
	message := sendgrid.NewMail()
	message.AddTo("<EMAIL>")
	message.AddToName("<NAME>")
	message.AddSubject("SendGrid is Baller")
	message.AddHTML("Simple Text")
	message.AddFrom("<EMAIL>")
	// use sendAPI instead of SMTP
	if r := sg.SendAPI(message); r == nil {
		fmt.Println("Email sent!")
	} else {
		c.Errorf("Unable to send mail %v",r)
	}
}

```

###Tests

Please run it before sending pull requests

```bash
go test
```


###Notes

SMTP has been added has a fallback. Basically invoking **Send** will call **SendAPI**. If that fails, **SendSMTP** will be invoked as a fallback. SMTP is still missing a few features; therefore it is recommended that **SendAPI** & **Send** are the primary methods.


###TODO

* Finish implementing SMTP
* Implement additional API endpoints

##MIT License

Enjoy. Feel free to make pull requests :)

{'fraction_non_alphanumeric': 0.15645161290322582, 'fraction_numerical': 0.0013824884792626728, 'mean_word_length': 4.795727636849132, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5538534', 'n_tokens_mistral': 1560, 'n_tokens_neox': 1527, 'n_words': 378}