Run sendmail.
307{
308 char *ps = NULL;
309 char *path = NULL;
310 char *s = NULL;
311 char *childout = NULL;
314 int i;
315
317 {
319
324 {
326 unlink(msg);
328 return i;
329 }
330
333 }
334 else
335 {
338 }
339
340 if (!s)
341 {
342 mutt_error(
_(
"$sendmail must be set in order to send mail"));
343 return -1;
344 }
345
346 ps = s;
347 i = 0;
348 while ((ps = strtok(ps, " ")))
349 {
350 if (i)
351 {
353 break;
355 }
356 else
357 {
359 ps = strrchr(ps, '/');
360 if (ps)
361 ps++;
362 else
363 ps = path;
365 }
366 ps = NULL;
367 i++;
368 }
369
371 {
372
373
374 if (ps)
375 {
376 ps = NULL;
377 while ((ps = strtok(ps, " ")))
378 {
380 ps = NULL;
381 }
382 }
383
384 const bool c_use_8bit_mime =
cs_subset_bool(sub,
"use_8bit_mime");
385 if (eightbit && c_use_8bit_mime)
387
388 const bool c_use_envelope_from =
cs_subset_bool(sub,
"use_envelope_from");
389 if (c_use_envelope_from)
390 {
392 if (c_envelope_from_address)
393 {
396 }
398 {
401 }
402 }
403
405 if (c_dsn_notify)
406 {
409 }
410
412 if (c_dsn_return)
413 {
416 }
418 const char **e = NULL;
420 {
422 }
426 }
427
429
431 i =
send_msg(path, &args, msg,
OptGui ? &childout : NULL, c_sendmail_wait);
432
433
434
435
436
438 {
440 }
441
442 if (i != (
EX_OK & 0xff))
443 {
445 {
448 if (childout)
449 {
450 struct stat st = { 0 };
451
452 if ((stat(childout, &st) == 0) && (st.st_size > 0))
453 {
456
458
459 pview.
banner =
_(
"Output of the delivery process");
462
464 }
465 }
466 }
467 }
468 else if (childout)
469 {
470 unlink(childout);
471 }
472
478
479 if (i == (
EX_OK & 0xff))
480 i = 0;
482 i = 1;
483 else
484 i = -1;
485 return i;
486}
const struct Address * cs_subset_address(const struct ConfigSubset *sub, const char *name)
Get an Address config item by name.
#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.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
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 Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
void mutt_need_hard_redraw(void)
Force a hard refresh.
int expando_filter(const struct Expando *exp, const struct ExpandoRenderCallback *erc, void *data, MuttFormatFlags flags, int max_cols, char **env_list, struct Buffer *buf)
Render an Expando and run the result through a filter.
const struct ExpandoRenderCallback NntpRenderCallbacks[]
Callbacks for Newsrc Expandos.
bool OptGui
(pseudo) when the gui (and curses) are started
bool OptNewsSend
(pseudo) used to change behavior when posting
#define FREE(x)
Free memory and set the pointer to NULL.
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.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
#define TAILQ_FIRST(head)
#define TAILQ_NEXT(elm, field)
#define TAILQ_EMPTY(head)
@ MUTT_FORMAT_NONE
No flags are set.
static int send_msg(const char *path, struct StringArray *args, const char *msg, char **tempfile, int wait_time)
Invoke sendmail in a subshell.
static void add_args(struct StringArray *args, struct AddressList *al)
Add a list of Addresses to a dynamic array.
static void add_args_one(struct StringArray *args, const struct Address *addr)
Add an Address to a dynamic array.
String manipulation buffer.
size_t dsize
Length of data.
Container for Accounts, Notifications.
char ** env
Private copy of the environment variables.