Run sendmail.
303{
304 char *ps = NULL;
305 char *path = NULL;
306 char *s = NULL;
307 char *childout = NULL;
310 int i;
311
313 {
315
320 {
322 unlink(msg);
324 return i;
325 }
326
329 }
330 else
331 {
334 }
335
336 if (!s)
337 {
338 mutt_error(
_(
"$sendmail must be set in order to send mail"));
339 return -1;
340 }
341
342 ps = s;
343 i = 0;
344 while ((ps = strtok(ps, " ")))
345 {
346 if (i)
347 {
349 break;
351 }
352 else
353 {
355 ps = strrchr(ps, '/');
356 if (ps)
357 ps++;
358 else
359 ps = path;
361 }
362 ps = NULL;
363 i++;
364 }
365
367 {
368
369
370 if (ps)
371 {
372 ps = NULL;
373 while ((ps = strtok(ps, " ")))
374 {
376 ps = NULL;
377 }
378 }
379
380 const bool c_use_8bit_mime =
cs_subset_bool(sub,
"use_8bit_mime");
381 if (eightbit && c_use_8bit_mime)
383
384 const bool c_use_envelope_from =
cs_subset_bool(sub,
"use_envelope_from");
385 if (c_use_envelope_from)
386 {
388 if (c_envelope_from_address)
389 {
392 }
394 {
397 }
398 }
399
401 if (c_dsn_notify)
402 {
405 }
406
408 if (c_dsn_return)
409 {
412 }
414 const char **e = NULL;
416 {
418 }
422 }
423
425
427 i =
send_msg(path, &args, msg,
OptGui ? &childout : NULL, c_sendmail_wait);
428
429
430
431
432
434 {
436 }
437
438 if (i != (
EX_OK & 0xff))
439 {
441 {
444 if (childout)
445 {
446 struct stat st = { 0 };
447
448 if ((stat(childout, &st) == 0) && (st.st_size > 0))
449 {
452
454
455 pview.
banner =
_(
"Output of the delivery process");
458
460 }
461 }
462 }
463 }
464 else if (childout)
465 {
466 unlink(childout);
467 }
468
474
475 if (i == (
EX_OK & 0xff))
476 i = 0;
478 i = 1;
479 else
480 i = -1;
481 return i;
482}
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.