On Thu, 21 Mar 2019 11:56:21 +0530 pradam <[email protected]> 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: [email protected]\r\n
To: [email protected]\r\n
Date: Thu Mar 21 19:34:02 NZDT 2019
Message-ID: [email protected]
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: [email protected], [email protected]"
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
pgpLjoIKyMdIs.pgp
Description: OpenPGP digital signature
