- mutt_mktemp (tempfile);
- if ((s.fpout = safe_fopen (tempfile, "w+")) == NULL) {
- mutt_perror (tempfile);
+ s.fpout = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL);
+ if (!s.fpout) {
+ mutt_error(_("Could not create temporary file"));