Not able to send mail to DL contacts using sendgrid

18 Views Asked by At

Below is my code code which is I'm trying to send mail to DL contacts but the recipients are not receiving any mail but i can see 202 HTTP response once i send it but it works if i send mail to 1 contact

func main() {
    from := mail.NewEmail("test DL mail sending with sendgrid", "[email protected]")
    subject := "test DL mail sending with sendgrid"
    to := mail.NewEmail("Example User", "[email protected]")
    plainTextContent := "test DL mail sending with sendgrid"
    htmlContent := "<strong>test DL mail sending with sendgrid</strong>"
    message := mail.NewSingleEmail(from, subject, to, plainTextContent, htmlContent)
    client := sendgrid.NewSendClient("key")
    response, err := client.Send(message)
    if err != nil {
        log.Println(err)
    } else {
        fmt.Println(response.StatusCode)
        fmt.Println(response.Body)
        fmt.Println(response.Headers)
    }
}
0

There are 0 best solutions below