On Thu, 21 Mar 2019 11:56:21 +0530 pradam <pradam.programm...@gmail.com> wrote:
> I have implement below code, but body not showing up, so whats wrong
> with the code?
> 
> [..]
>
> _, err = fmt.Fprintf(wc, "This is the email body")
> if err != nil {
>     log.Fatal(err)
> }
>
> [..]

You are not sending any header fields; an email should look like:

    From: sen...@example.com\r\n
    To: r...@example.com\r\n
    Date: Thu Mar 21 19:34:02 NZDT 2019
    Message-ID: ran...@mail.example.com
    Content-Type: txt/plain; charset=utf-8
    Subject: Hey there!\r\n
    \r\n
    The message body\r\n

It's important that you're careful to not allow untrusted user input in the
headers, otherwise someone could inject headers by setting a subject to
something like this:

    "spam\r\nCc: vict...@example.com, vict...@exampele.com"

And you'll be spamming all of the internet.

You'll also want to use Transfer-Encoding: quoted-printable
(mime/quotedprintable package).

-- 
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.

Attachment: pgpLjoIKyMdIs.pgp
Description: OpenPGP digital signature

Reply via email to