Run sendmail.
299{
300 char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
303 int i;
304
306 {
307 char cmd[1024] = { 0 };
308
312 if (*cmd == '\0')
313 {
315 unlink(msg);
316 return i;
317 }
318
320 }
321 else
322 {
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
358 {
359
360
361 if (ps)
362 {
363 ps = NULL;
364 while ((ps = strtok(ps, " ")))
365 {
367 ps = NULL;
368 }
369 }
370
371 const bool c_use_8bit_mime =
cs_subset_bool(sub,
"use_8bit_mime");
372 if (eightbit && c_use_8bit_mime)
374
375 const bool c_use_envelope_from =
cs_subset_bool(sub,
"use_envelope_from");
376 if (c_use_envelope_from)
377 {
379 if (c_envelope_from_address)
380 {
383 }
385 {
388 }
389 }
390
392 if (c_dsn_notify)
393 {
396 }
397
399 if (c_dsn_return)
400 {
403 }
405 const char **e = NULL;
407 {
409 }
413 }
414
416
419
420
421
422
423
425 {
427 }
428
429 if (i != (
EX_OK & 0xff))
430 {
432 {
435 if (childout)
436 {
437 struct stat st = { 0 };
438
439 if ((stat(childout, &st) == 0) && (st.st_size > 0))
440 {
443
445
446 pview.
banner =
_(
"Output of the delivery process");
449
451 }
452 }
453 }
454 }
455 else if (childout)
456 {
457 unlink(childout);
458 }
459
465
466 if (i == (
EX_OK & 0xff))
467 i = 0;
469 i = 1;
470 else
471 i = -1;
472 return i;
473}
#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.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
const struct Address * cs_subset_address(const struct ConfigSubset *sub, const char *name)
Get an Address 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 SendmailArgArray *args, const struct Address *addr)
Add an Address to a dynamic array.
static void add_args(struct SendmailArgArray *args, struct AddressList *al)
Add a list of Addresses to a dynamic array.
static int send_msg(const char *path, struct SendmailArgArray *args, const char *msg, char **tempfile, int wait_time)
Invoke sendmail in a subshell.