aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--widgets/compose.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index 8fc34b4..dc12e60 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -278,7 +278,13 @@ func (c *Composer) PrepareHeader() (*mail.Header, []string, error) {
}
func (c *Composer) WriteMessage(header *mail.Header, writer io.Writer) error {
- c.email.Seek(0, os.SEEK_SET)
+ name := c.email.Name()
+ c.email.Close()
+ file, err := os.Open(name)
+ if err != nil {
+ return errors.Wrap(err, "FileOpen")
+ }
+ c.email = file
var body io.Reader
reader, err := mail.CreateReader(c.email)
if err == nil {