Run sendmail.
302{
303 char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
306 int i;
307
308#ifdef USE_NNTP
310 {
311 char cmd[1024] = { 0 };
312
316 if (*cmd == '\0')
317 {
319 unlink(msg);
320 return i;
321 }
322
324 }
325 else
326#endif
327 {
330 }
331
332
333 if (!s)
334 {
335 mutt_error(
_(
"$sendmail must be set in order to send mail"));
336 return -1;
337 }
338
339 ps = s;
340 i = 0;
341 while ((ps = strtok(ps, " ")))
342 {
343 if (i)
344 {
346 break;
348 }
349 else
350 {
352 ps = strrchr(ps, '/');
353 if (ps)
354 ps++;
355 else
356 ps = path;
358 }
359 ps = NULL;
360 i++;
361 }
362
363#ifdef USE_NNTP
365 {
366#endif
367
368
369 if (ps)
370 {
371 ps = NULL;
372 while ((ps = strtok(ps, " ")))
373 {
375 ps = NULL;
376 }
377 }
378
379 const bool c_use_8bit_mime =
cs_subset_bool(sub,
"use_8bit_mime");
380 if (eightbit && c_use_8bit_mime)
382
383 const bool c_use_envelope_from =
cs_subset_bool(sub,
"use_envelope_from");
384 if (c_use_envelope_from)
385 {
387 if (c_envelope_from_address)
388 {
391 }
393 {
396 }
397 }
398
400 if (c_dsn_notify)
401 {
404 }
405
407 if (c_dsn_return)
408 {
411 }
413 const char **e = NULL;
415 {
417 }
421#ifdef USE_NNTP
422 }
423#endif
424
426
429
430
431
432
433
435 {
437 }
438
439 if (i != (
EX_OK & 0xff))
440 {
442 {
445 if (childout)
446 {
447 struct stat st = { 0 };
448
449 if ((stat(childout, &st) == 0) && (st.st_size > 0))
450 {
453
455
456 pview.
banner =
_(
"Output of the delivery process");
459
461 }
462 }
463 }
464 }
465 else if (childout)
466 {
467 unlink(childout);
468 }
469
475
476 if (i == (
EX_OK & 0xff))
477 i = 0;
479 i = 1;
480 else
481 i = -1;
482 return i;
483}
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
#define ARRAY_FREE(head)
Release all memory.
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
const struct Address * cs_subset_address(const struct ConfigSubset *sub, const char *name)
Get an Address config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
void mutt_need_hard_redraw(void)
Force a hard refresh.
bool OptNoCurses
(pseudo) when sending in batch mode
bool OptNewsSend
(pseudo) used to change behavior when posting
const char * nntp_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
Expand the newsrc filename - Implements format_t -.
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t callback, intptr_t data, MuttFormatFlags flags)
Expand expandos (x) in a string -.
char * mutt_str_dup(const char *str)
Copy a string, safely.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
const char * mutt_str_sysexit(int err_num)
Return a string matching an error code.
int nntp_post(struct Mailbox *m, const char *msg)
Post article.
#define TAILQ_FIRST(head)
#define TAILQ_NEXT(elm, field)
#define TAILQ_EMPTY(head)
static void add_args_one(struct SendmailArgs *args, const struct Address *addr)
Add an Address to a dynamic array.
static int send_msg(const char *path, struct SendmailArgs *args, const char *msg, char **tempfile, int wait_time)
Invoke sendmail in a subshell.
static void add_args(struct SendmailArgs *args, struct AddressList *al)
Add a list of Addresses to a dynamic array.