Rawit_S
Rawit_S

Reputation: 85

SMTP can send reply mail?

I using golang with emersion/go-smtp and gomail to send mail. It working fine to send email to account. But I have some problem I cannot send email with reply that email who send to me.

For example,

A(Sender) send mail to B(Me) I can get messageID of A mail with IMAP. I try to send reply mail with In-Reply-To and References with sender messageID mail. Unfortunately it send email to new mail (not ref with A mail)

Some code and header I setup to send mail.

gomail

    // Set E-Mail sender
    m.SetHeader("From", "[email protected]")

    // Set E-Mail receivers
    m.SetHeader("To", "[email protected]")

    m.SetHeader("In-Reply-To", "<messageID of A mail>")

    m.SetHeader("References", "<messageID of A mail>")

    // Set E-Mail subject
    m.SetHeader("Subject", "reply mail")

    // Set E-Mail body. You can set plain text or html with text/html
    m.SetBody("text/plain", "test reply mail")

emersion/go-smtp

msg := strings.NewReader(
    "In-Reply-To: <messageID of A mail>\r\n" +
        "To: [email protected]\r\n" +
        "References: <messageID of A mail>\r\n" +
        "Subject: reply mail\r\n" +
        "\r\n" +
        "test reply mail\r\n")

Upvotes: 1

Views: 573

Answers (0)

Related Questions