I have implement below code, but body not showing up, so whats wrong
with the code?

// Connect to the remote SMTP server.
c, err := smtp.Dial("mail.example.com:25")
if err != nil {
    log.Fatal(err)
}
// Set the sender and recipient first
if err := c.Mail("sen...@example.org"); err != nil {
    log.Fatal(err)
}
if err := c.Rcpt("recipi...@example.net"); err != nil {
    log.Fatal(err)
}
// Send the email body.
wc, err := c.Data()
if err != nil {
    log.Fatal(err)
}
_, err = fmt.Fprintf(wc, "This is the email body")
if err != nil {
    log.Fatal(err)
}
err = wc.Close()
if err != nil {
    log.Fatal(err)
}
// Send the QUIT command and close the connection.
err = c.Quit()
if err != nil {
    log.Fatal(err)
}

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to