H
H
HPositron2020-09-08 21:17:01
go
HPositron, 2020-09-08 21:17:01

How to send a file via smtp using Golang?

How to attach a file read with help ioutil.ReadFile()to an email?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
uvelichitel, 2020-09-08
@HPositron

To attach a file, you need to include headers in the transmitted data.

  • "Content-Type: multipart/mixed"
  • "Content-Disposition: attachment"

On net/smtp from the standard library, for example, this is done like this https://gist.github.com/guinso/8405a991d8a095b0142...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question