[resending, as my original post never made it to the group] Gnus (latest CVS) generates wrong MIME encoded messages when an inline PGP signature is included along with an attachment. When a multipart message is sent, gnus builds a buffer by adding each part sequentially, top to bottom. But there's a bug with the code that generates inline signed parts: the point is not moved back to the bottom of the buffer, and so the following parts are inserted at the wrong place. A fix is simple: after each part is generated, move the point back to the end. i.e, in mml.el, around line 590, where it iterates over each part, inserting a separator between each part and at the end. (let ((cont cont) part) (while (setq part (pop cont)) ;; Skip `multipart' and attributes. (when (and (consp part) (consp (cdr part))) (insert "\n--" mml-boundary "\n") (mml-generate-mime-1 part)))) (insert "\n--" mml-boundary "--\n"))))) Just insert "(goto-char (point-max))" after the call to mml-generate-mime-1: (let ((cont cont) part) (while (setq part (pop cont)) ;; Skip `multipart' and attributes. (when (and (consp part) (consp (cdr part))) (insert "\n--" mml-boundary "\n") (mml-generate-mime-1 part) (goto-char (point-max))))) (insert "\n--" mml-boundary "--\n"))))) I've tried it on various messages containing various attachments and it seems to do the trick. A diff against mml.el 7.40 is attached. Max.