Run sendmail.
304{
305 char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
308 int i;
309
311 {
313
317 {
319 unlink(msg);
321 return i;
322 }
323
326 }
327 else
328 {
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
364 {
365
366
367 if (ps)
368 {
369 ps = NULL;
370 while ((ps = strtok(ps, " ")))
371 {
373 ps = NULL;
374 }
375 }
376
377 const bool c_use_8bit_mime =
cs_subset_bool(sub,
"use_8bit_mime");
378 if (eightbit && c_use_8bit_mime)
380
381 const bool c_use_envelope_from =
cs_subset_bool(sub,
"use_envelope_from");
382 if (c_use_envelope_from)
383 {
385 if (c_envelope_from_address)
386 {
389 }
391 {
394 }
395 }
396
398 if (c_dsn_notify)
399 {
402 }
403
405 if (c_dsn_return)
406 {
409 }
411 const char **e = NULL;
413 {
415 }
419 }
420
422
425
426
427
428
429
431 {
433 }
434
435 if (i != (
EX_OK & 0xff))
436 {
438 {
441 if (childout)
442 {
443 struct stat st = { 0 };
444
445 if ((stat(childout, &st) == 0) && (st.st_size > 0))
446 {
449
451
452 pview.
banner =
_(
"Output of the delivery process");
455
457 }
458 }
459 }
460 }
461 else if (childout)
462 {
463 unlink(childout);
464 }
465
471
472 if (i == (
EX_OK & 0xff))
473 i = 0;
475 i = 1;
476 else
477 i = -1;
478 return i;
479}
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 ExpandoRenderData *rdata, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando and run the result through a filter.
bool OptNoCurses
(pseudo) when sending in batch mode
bool OptNewsSend
(pseudo) used to change behavior when posting
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.
const struct ExpandoRenderData NntpRenderData[]
Callbacks for Newsrc Expandos.
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)
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
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.
String manipulation buffer.
size_t dsize
Length of data.