-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send a Single Email to a Single Recipient #87
Comments
What's the status of this issue? I'll like to work on it if it's still open. |
@andela-ooranagwa, This issue is still available. My comments on a similar issue in our Java library may be helpful: sendgrid/sendgrid-java#150 Also, we will need a signed CLA in order to merge your work. Please sign that for us here: https://github.com/sendgrid/sendgrid-go/blob/master/CONTRIBUTING.md#cla Thank you! With Best Regards, Elmer |
I will appreciate if can you provide some more details? Similar to what was pointed out in the Java library, sendgrid-go already has a NewEmail that is used to compose and send email to a single recipient. More details about |
Hello @andela-ooranagwa, Thanks for reaching out! I'm thinking that the end result would be something like: package main
import (
"fmt"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/mail"
"log"
"os"
)
func main() {
client := sendgrid.NewClient(os.Getenv("SENDGRID_API_KEY")) // This lives in sendgrid-go
email := sendgrid.NewEmail() // Or you could pass the following directly into the contructor
email.SetFrom("Example User", "test@example.com")
email.SetSubject("Hello World from the SendGrid Go Library")
email.AddTo("Example User", "test@example.com")
email.AddContent("text/plain", "some text here")
response, err := client.Send(email)
if err != nil {
log.Println(err)
} Behind the scenes the Email class handles the verifications and building the request body. |
Some additional notes:
|
This is much more helpful. Thank you for providing more details |
Acceptance Criteria:
Reference:
The text was updated successfully, but these errors were encountered: