Skip to content
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

Closed
thinkingserious opened this issue Oct 6, 2016 · 6 comments
Closed

Send a Single Email to a Single Recipient #87

thinkingserious opened this issue Oct 6, 2016 · 6 comments
Labels
status: work in progress Twilio or the community is in the process of implementing type: community enhancement feature request not on Twilio's roadmap

Comments

@thinkingserious
Copy link
Contributor

Acceptance Criteria:

  • A email object that represents the response body payload
  • A mail object that handles sending email objects, data validation and error handling

Reference:

@thinkingserious thinkingserious added status: help wanted requesting help from the community type: task labels Oct 6, 2016
@0sc
Copy link

0sc commented Oct 8, 2016

What's the status of this issue? I'll like to work on it if it's still open.

@thinkingserious
Copy link
Contributor Author

@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

@thinkingserious thinkingserious added status: work in progress Twilio or the community is in the process of implementing and removed status: help wanted requesting help from the community labels Oct 10, 2016
@0sc
Copy link

0sc commented Oct 20, 2016

@thinkingserious

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.
Your comment implies that this issue is merely a refactor, if so what implementation behavior do you desire? A single object that bundles and encapsulates both setting up and send the email or rewrite of the existing method?

More details about A email object that represents the response body payload could help

@thinkingserious
Copy link
Contributor Author

thinkingserious commented Oct 20, 2016

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.

@thinkingserious
Copy link
Contributor Author

Some additional notes:

  • The content body should take a IO.Reader
  • The response should be custom and strongly typed

@0sc
Copy link

0sc commented Oct 20, 2016

This is much more helpful. Thank you for providing more details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: work in progress Twilio or the community is in the process of implementing type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

2 participants