mail is moved to sent folder after sending
2 files changed, 11 insertions(+), 5 deletions(-)

M cmd/mb/main.go
M edit.go
M cmd/mb/main.go +9 -2
@@ 267,11 267,18 @@ func main() {
 			break
 		}
 		if err = mb.Send(msg); err != nil {
-			// todo: move msg from draft to sent
+			src.Close()
+			break
+		}
+		if err = src.Close(); err != nil {
+			break
 		}
-		if err1 := src.Close(); err == nil {
+		folder, msgs, err1 := parseSequence(mbox, os.Args[2])
+		if err1 != nil {
 			err = err1
+			break
 		}
+		err = mb.Move(mbox, folder, msgs, mbox.Sent())
 	case "mv":
 		// todo: defaultfolder
 		if len(os.Args) < 4 {

          
M edit.go +2 -3
@@ 144,7 144,7 @@ func edit(mbox Mailbox, msg *mail.Messag
 	return msgfile, err
 }
 
-// todo: multipart
+// bug: not multipart-ready
 // we need something different:
 // for a reply we need this func
 // for a forward we have to retain content type header, so we can

          
@@ 156,7 156,6 @@ func encodeMessage(dst io.Writer, msg *m
 
 	h := textproto.MIMEHeader(msg.Header)
 	h.Set("Date", time.Now().Format("Mon, 2 Jan 2006 15:04:05 -0700"))
-	// todo: not utf-8, we use quoted printable!
 	h.Set("Content-Type", "text/plain; charset=utf-8")
 	h.Set("Content-Transfer-Encoding", "quoted-printable")
 	h.Set("Mime-Version", "1.0")

          
@@ 165,7 164,7 @@ func encodeMessage(dst io.Writer, msg *m
 	}
 	dec := qp.NewWriter(buf)
 	defer dec.Close()
-	if _, err := io.Copy(qp.NewWriter(buf), msg.Body); err != nil {
+	if _, err := io.Copy(dec, msg.Body); err != nil {
 		return err
 	}
 	if err := dec.Close(); err != nil {