Run sendmail.
296{
297 char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
300 int i;
301
302#ifdef USE_NNTP
304 {
305 char cmd[1024] = { 0 };
306
310 if (*cmd == '\0')
311 {
313 unlink(msg);
314 return i;
315 }
316
318 }
319 else
320#endif
321 {
324 }
325
326
327 if (!s)
328 {
329 mutt_error(
_(
"$sendmail must be set in order to send mail"));
330 return -1;
331 }
332
333 ps = s;
334 i = 0;
335 while ((ps = strtok(ps, " ")))
336 {
337 if (i)
338 {
340 break;
342 }
343 else
344 {
346 ps = strrchr(ps, '/');
347 if (ps)
348 ps++;
349 else
350 ps = path;
352 }
353 ps = NULL;
354 i++;
355 }
356
357#ifdef USE_NNTP
359 {
360#endif
361
362
363 if (ps)
364 {
365 ps = NULL;
366 while ((ps = strtok(ps, " ")))
367 {
369 ps = NULL;
370 }
371 }
372
373 const bool c_use_8bit_mime =
cs_subset_bool(sub,
"use_8bit_mime");
374 if (eightbit && c_use_8bit_mime)
376
377 const bool c_use_envelope_from =
cs_subset_bool(sub,
"use_envelope_from");
378 if (c_use_envelope_from)
379 {
381 if (c_envelope_from_address)
382 {
385 }
387 {
390 }
391 }
392
394 if (c_dsn_notify)
395 {
398 }
399
401 if (c_dsn_return)
402 {
405 }
407 const char **e = NULL;
409 {
411 }
415#ifdef USE_NNTP
416 }
417#endif
418
420
423
424
425
426
427
429 {
431 }
432
433 if (i != (
EX_OK & 0xff))
434 {
436 {
439 if (childout)
440 {
441 struct stat st = { 0 };
442
443 if ((stat(childout, &st) == 0) && (st.st_size > 0))
444 {
447
449
450 pview.
banner =
_(
"Output of the delivery process");
453
455 }
456 }
457 }
458 }
459 else if (childout)
460 unlink(childout);
461
467
468 if (i == (
EX_OK & 0xff))
469 i = 0;
471 i = 1;
472 else
473 i = -1;
474 return i;
475}
#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.
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.
bool OptNoCurses
(pseudo) when sending in batch mode
bool OptNewsSend
(pseudo) used to change behavior when posting
#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.