Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
gahr committed Sep 22, 2021
1 parent e531da3 commit 9009f4c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions send/send.c
Expand Up @@ -2970,31 +2970,35 @@ static bool send_simple_email(struct Mailbox *m, const char *mailto,
const char *to, const char *subj, const char *body)
{
struct Email *e = email_new();
e->env = mutt_env_new();

/* envelope */
e->env = mutt_env_new();
mutt_parse_mailto(e->env, NULL, mailto);

if (!e->env->subject)
{
e->env->subject = mutt_str_dup(subj);
}

if (TAILQ_EMPTY(&e->env->to) && !mutt_addrlist_parse(&e->env->to, to))
{
mutt_warning(_("No recipient specified"));
}

/* body */
e->body = mutt_body_new();
char ctype[] = "text/plain";
mutt_parse_content_type(ctype, e->body);

char tempfile[PATH_MAX];
char tempfile[PATH_MAX] = { 0 };
mutt_mktemp(tempfile, sizeof(tempfile));
FILE *fp = mutt_file_fopen(tempfile, "w+");
fprintf(fp, "%s\n", body);
mutt_file_fclose(&fp);
e->body->unlink = true;
if (body)
{
FILE *fp = mutt_file_fopen(tempfile, "w+");
fprintf(fp, "%s\n", body);
mutt_file_fclose(&fp);
}
e->body->filename = mutt_str_dup(tempfile);
e->body->unlink = true;

const int rc = mutt_send_message(SEND_DRAFT_FILE, e, NULL, m, NULL, NeoMutt->sub);
return rc >= 0;
}
Expand Down

0 comments on commit 9009f4c

Please sign in to comment.