Run sendmail.
303{
304 char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
307 int i;
308
310 {
312
316 {
318 unlink(msg);
320 return i;
321 }
322
325 }
326 else
327 {
330 }
331
332 if (!s)
333 {
334 mutt_error(
_(
"$sendmail must be set in order to send mail"));
335 return -1;
336 }
337
338 ps = s;
339 i = 0;
340 while ((ps = strtok(ps, " ")))
341 {
342 if (i)
343 {
345 break;
347 }
348 else
349 {
351 ps = strrchr(ps, '/');
352 if (ps)
353 ps++;
354 else
355 ps = path;
357 }
358 ps = NULL;
359 i++;
360 }
361
363 {
364
365
366 if (ps)
367 {
368 ps = NULL;
369 while ((ps = strtok(ps, " ")))
370 {
372 ps = NULL;
373 }
374 }
375
376 const bool c_use_8bit_mime =
cs_subset_bool(sub,
"use_8bit_mime");
377 if (eightbit && c_use_8bit_mime)
379
380 const bool c_use_envelope_from =
cs_subset_bool(sub,
"use_envelope_from");
381 if (c_use_envelope_from)
382 {
384 if (c_envelope_from_address)
385 {
388 }
390 {
393 }
394 }
395
397 if (c_dsn_notify)
398 {
401 }
402
404 if (c_dsn_return)
405 {
408 }
410 const char **e = NULL;
412 {
414 }
418 }
419
421
424
425
426
427
428
430 {
432 }
433
434 if (i != (
EX_OK & 0xff))
435 {
437 {
440 if (childout)
441 {
442 struct stat st = { 0 };
443
444 if ((stat(childout, &st) == 0) && (st.st_size > 0))
445 {
448
450
451 pview.
banner =
_(
"Output of the delivery process");
454
456 }
457 }
458 }
459 }
460 else if (childout)
461 {
462 unlink(childout);
463 }
464
470
471 if (i == (
EX_OK & 0xff))
472 i = 0;
474 i = 1;
475 else
476 i = -1;
477 return i;
478}
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_render(const struct Expando *exp, const struct ExpandoRenderData *rdata, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando + data into a string.
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.