131 fputs(
"\n-- \n", fp);
146 struct Address *a = NULL, *tmp = NULL;
164 const struct AddressList *c)
166 const struct AddressList *
const als[] = { t, c };
168 for (
size_t i = 0; i <
countof(als); i++)
170 const struct AddressList *al = als[i];
221 }
while (idna_ok != 0);
260 const bool c_ask_followup_to =
cs_subset_bool(sub,
"ask_followup_to");
274 const bool c_ask_x_comment_to =
cs_subset_bool(sub,
"ask_x_comment_to");
275 if (c_x_comment_to && c_ask_x_comment_to &&
311 const bool c_reply_with_xorig =
cs_subset_bool(sub,
"reply_with_xorig");
331 const char *p = NULL;
457 if (!c_forward_attribution_intro || !fp)
460 const char *
const c_attribution_locale =
cs_subset_string(sub,
"attribution_locale");
463 setlocale(LC_TIME,
NONULL(c_attribution_locale));
466 setlocale(LC_TIME,
"");
481 if (!c_forward_attribution_trailer || !fp)
484 const char *
const c_attribution_locale =
cs_subset_string(sub,
"attribution_locale");
487 setlocale(LC_TIME,
NONULL(c_attribution_locale));
490 setlocale(LC_TIME,
"");
520 const bool c_forward_decode =
cs_subset_bool(sub,
"forward_decode");
533 if (c_forward_decode)
545 const bool c_forward_quote =
cs_subset_bool(sub,
"forward_quote");
569 struct Body **last = *plast;
570 struct Body *body = NULL;
590 for (i = 0; i < actx->
idxlen; i++)
608 *forwardq =
query_quadoption(
_(
"Forward attachments?"), sub,
"forward_attachments");
621 last = &((*last)->next);
645 const char *
const c_attribution_locale =
cs_subset_string(sub,
"attribution_locale");
648 setlocale(LC_TIME,
NONULL(c_attribution_locale));
650 setlocale(LC_TIME,
"");
689 if (!c_greeting || !fp_out)
808 const bool multiple_reply_to = reply_to &&
811 const bool c_ignore_list_reply_to =
cs_subset_bool(sub,
"ignore_list_reply_to");
813 if ((from_is_reply_to && !multiple_reply_to && !reply_to->
personal) ||
825 else if (!(from_is_reply_to && !multiple_reply_to) && (c_reply_to !=
MUTT_YES))
827 char prompt[256] = { 0 };
834 snprintf(prompt,
sizeof(prompt),
_(
"Reply to %s%s?"),
880 char prompt[256] = { 0 };
881 snprintf(prompt,
sizeof(prompt),
_(
"Follow-up to %s%s?"),
894 if (followup_to && (hmfupto ==
MUTT_YES) &&
913 (!followup_to || (hmfupto !=
MUTT_YES)))
1008 if (!env || !env_cur)
1022 const char *
const c_empty_subject =
cs_subset_string(sub,
"empty_subject");
1057 struct Email **ep = NULL;
1060 struct Email *e = *ep;
1108 struct Email **ep = NULL;
1111 struct Email *e = *ep;
1137 const bool c_forward_references =
cs_subset_bool(sub,
"forward_references");
1138 if (c_forward_references)
1172 struct Email **ep = NULL;
1178 mutt_error(
_(
"Could not include all requested messages"));
1181 if (ARRAY_FOREACH_IDX_ep < count)
1183 fputc(
'\n', fp_tmp);
1197 while (last && last->
next)
1200 struct Email **ep = NULL;
1219 struct Body **last = NULL;
1221 const bool c_forward_decode =
cs_subset_bool(sub,
"forward_decode");
1223 if (c_forward_decode && (c_forward_attachments !=
MUTT_NO))
1227 last = &((*last)->next);
1230 struct Email **ep = NULL;
1233 struct Email *e_cur = *ep;
1235 if (c_forward_decode && (c_forward_attachments !=
MUTT_NO))
1249 struct Body *b = NULL;
1307 struct AddressList *al = NULL;
1383 const bool c_reverse_real_name =
cs_subset_bool(sub,
"reverse_real_name");
1384 if (!c_reverse_real_name)
1406 char domain[1024] = { 0 };
1429 struct Buffer *tempfile = NULL;
1449 fputc(
'\n', fp_tmp);
1493 for (
struct Body *t = b; t; t = t->
next)
1497 rfc2047_encode(&t->description, NULL,
sizeof(
"Content-Description:"), c_send_charset);
1499 if (recurse && t->parts)
1510 for (
struct Body *t = b; t; t = t->
next)
1567 const bool c_smime_is_default =
cs_subset_bool(sub,
"smime_is_default");
1576 const bool c_crypt_opportunistic_encrypt =
cs_subset_bool(sub,
"crypt_opportunistic_encrypt");
1577 if (c_crypt_opportunistic_encrypt)
1601 if (!reply || !reply->
env || !orig || !orig->
env)
1624 if (!c_abort_noattach_regex || !c_abort_noattach_regex->
regex ||
1625 !c_quote_regex || !c_quote_regex->
regex)
1636 while (!feof(fp_att) && fgets(inputline, 1024, fp_att))
1664 struct Body *clear_content,
char *pgpkeylist,
1668 struct Body *save_content = NULL;
1683 mutt_error(
_(
"Warning: Fcc to an IMAP mailbox is not supported in batch mode"));
1698 struct Body *save_sig = NULL;
1699 struct Body *save_parts = NULL;
1701 const bool c_fcc_before_send =
cs_subset_bool(sub,
"fcc_before_send");
1705 if (!c_fcc_before_send)
1711 e->
body = clear_content;
1720 bool save_atts =
true;
1747 save_parts = clear_content->
parts->
next;
1762 save_content = e->
body;
1789 _(
"Fcc failed. (r)etry, alternate (m)ailbox, or (s)kip?"),
1799 rc =
mw_enter_fname(
_(
"Fcc mailbox"), fcc,
true, m,
false, NULL, NULL,
1820 if (!c_fcc_before_send)
1827 if (save_content->
parts)
1830 save_content->
parts = NULL;
1861 char *pgpkeylist = NULL;
1862 const char *encrypt_as = NULL;
1863 struct Body *clear_content = NULL;
1868 mutt_error(
_(
"Can't postpone. $postponed is unset"));
1877 const bool c_postpone_encrypt =
cs_subset_bool(sub,
"postpone_encrypt");
1878 if ((
WithCrypto != 0) && c_postpone_encrypt &&
1883 const char *
const c_pgp_default_key =
cs_subset_string(sub,
"pgp_default_key");
1884 encrypt_as = c_pgp_default_key;
1888 const char *
const c_smime_default_key =
cs_subset_string(sub,
"smime_default_key");
1889 encrypt_as = c_smime_default_key;
1893 const char *
const c_postpone_encrypt_as =
cs_subset_string(sub,
"postpone_encrypt_as");
1894 encrypt_as = c_postpone_encrypt_as;
1905 mutt_error(
_(
"Error encrypting message. Check your crypt settings."));
1915 clear_content = e_post->
body;
1922 mutt_error(
_(
"Error encrypting message. Check your crypt settings."));
1934 e_post->
read =
false;
1935 e_post->
old =
false;
1942 true, fcc, NULL, sub) < 0)
1947 e_post->
body = clear_content;
1987 if (c_abort_noattach ==
MUTT_NO)
1993 bool has_keyword =
false;
2016 mutt_error(
_(
"Message contains text matching \"$abort_noattach_regex\". Not sending."));
2039 FILE *fp_tmp = NULL;
2040 struct Body *pbody = NULL;
2042 bool free_clear_content =
false;
2044 struct Body *clear_content = NULL;
2045 char *pgpkeylist = NULL;
2047 char *pgp_sign_as = NULL;
2048 char *smime_sign_as = NULL;
2049 const char *tag = NULL;
2051 const char *ctype = NULL;
2052 char *finalpath = NULL;
2053 struct Email *e_cur = NULL;
2088 const char *
const c_smime_sign_as =
cs_subset_string(sub,
"smime_sign_as");
2158 e_templ->
body = pbody;
2161 ctype = c_content_type;
2163 ctype =
"text/plain";
2221 const bool c_reply_with_xorig =
cs_subset_bool(sub,
"reply_with_xorig");
2243 const bool c_resume_draft_files =
cs_subset_bool(sub,
"resume_draft_files");
2271 if (!(flags &
SEND_BATCH) && !(c_auto_edit && c_edit_headers) &&
2389 struct stat st = { 0 };
2395 if (mtime == (time_t) -1)
2415 (((flags &
SEND_FORWARD) == 0) || (c_edit_headers && c_auto_edit) ||
2428 else if (c_edit_headers)
2439 if (mtime != st.st_mtime)
2456 if ((mtime == st.st_mtime) && !e_templ->
body->
next &&
2483 bool c_autocrypt =
false;
2484 bool c_autocrypt_reply =
false;
2497 const bool c_crypt_auto_sign =
cs_subset_bool(sub,
"crypt_auto_sign");
2498 const bool c_crypt_auto_encrypt =
cs_subset_bool(sub,
"crypt_auto_encrypt");
2499 const bool c_crypt_reply_encrypt =
cs_subset_bool(sub,
"crypt_reply_encrypt");
2500 const bool c_crypt_reply_sign =
cs_subset_bool(sub,
"crypt_reply_sign");
2501 const bool c_crypt_reply_sign_encrypted =
cs_subset_bool(sub,
"crypt_reply_sign_encrypted");
2503 if (c_crypt_auto_sign)
2505 if (c_crypt_auto_encrypt)
2514 const bool c_crypt_opportunistic_encrypt =
cs_subset_bool(sub,
"crypt_opportunistic_encrypt");
2519 const bool c_pgp_auto_inline =
cs_subset_bool(sub,
"pgp_auto_inline");
2520 const bool c_pgp_reply_inline =
cs_subset_bool(sub,
"pgp_reply_inline");
2522 if (c_pgp_auto_inline)
2529 const bool c_crypt_opportunistic_encrypt =
cs_subset_bool(sub,
"crypt_opportunistic_encrypt");
2531 if (e_templ->
security || c_crypt_opportunistic_encrypt)
2533 const bool c_crypt_auto_pgp =
cs_subset_bool(sub,
"crypt_auto_pgp");
2534 const bool c_crypt_auto_smime =
cs_subset_bool(sub,
"crypt_auto_smime");
2557 const bool c_smime_is_default =
cs_subset_bool(sub,
"smime_is_default");
2579 if (c_crypt_opportunistic_encrypt)
2601 mutt_error(
_(
"No crypto backend configured. Disabling message security setting."));
2664 puts(
_(
"No recipients specified"));
2710 const bool c_confirm_empty_to =
cs_subset_bool(sub,
"confirm_empty_to");
2731 clear_content = NULL;
2732 free_clear_content =
false;
2739 clear_content = e_templ->
body;
2771 if (clear_content && (e_templ->
body != clear_content) &&
2772 (e_templ->
body->
parts != clear_content))
2773 free_clear_content =
true;
2781 const bool c_fcc_before_send =
cs_subset_bool(sub,
"fcc_before_send");
2782 if (c_fcc_before_send)
2783 save_fcc(m, e_templ, fcc, clear_content, pgpkeylist, flags, &finalpath, sub);
2795 if (e_templ->
body != clear_content)
2798 e_templ->
body = clear_content;
2823 puts(
_(
"Could not send the message"));
2828 if (!c_fcc_before_send)
2829 save_fcc(m, e_templ, fcc, clear_content, pgpkeylist, flags, &finalpath, sub);
2856 struct Email **ep = NULL;
2859 struct Email *e = *ep;
2880 FREE(&smime_sign_as);
2903 const char *mailto,
const char *subj,
const char *
body)
2921 char ctype[] =
"text/plain";
2935 fprintf(fp,
"%s\n", body);
struct Address * mutt_addr_create(const char *personal, const char *mailbox)
Create and populate a new Address.
void mutt_addrlist_copy(struct AddressList *dst, const struct AddressList *src, bool prune)
Copy a list of addresses into another list.
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
void mutt_addr_free(struct Address **ptr)
Free a single Address.
bool mutt_addr_valid_msgid(const char *msgid)
Is this a valid Message ID?
bool mutt_addr_cmp(const struct Address *a, const struct Address *b)
Compare two e-mail addresses.
void mutt_addrlist_append(struct AddressList *al, struct Address *a)
Append an Address to an AddressList.
int mutt_addrlist_to_local(struct AddressList *al)
Convert an Address list from Punycode.
size_t mutt_addrlist_write(const struct AddressList *al, struct Buffer *buf, bool display)
Write an Address to a buffer.
int mutt_addrlist_parse2(struct AddressList *al, const char *s)
Parse a list of email addresses.
struct Address * mutt_addr_copy(const struct Address *addr)
Copy the real address.
void mutt_addrlist_remove_xrefs(const struct AddressList *a, struct AddressList *b)
Remove cross-references.
int mutt_addrlist_count_recips(const struct AddressList *al)
Count the number of Addresses with valid recipients.
int mutt_addrlist_parse(struct AddressList *al, const char *s)
Parse a list of email addresses.
void mutt_addrlist_prepend(struct AddressList *al, struct Address *a)
Prepend an Address to an AddressList.
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
bool mutt_addrlist_search(const struct AddressList *haystack, const struct Address *needle)
Search for an e-mail address in a list.
void mutt_addrlist_dedupe(struct AddressList *al)
Remove duplicate addresses.
const struct Address * cs_subset_address(const struct ConfigSubset *sub, const char *name)
Get an Address config item by name.
const struct CompleteOps CompleteAliasOps
Auto-Completion of Aliases.
void mutt_expand_aliases(struct AddressList *al)
Expand aliases in a List of Addresses.
bool mutt_addr_is_user(const struct Address *addr)
Does the address belong to the user.
void mutt_expand_aliases_env(struct Envelope *env)
Expand aliases in all the fields of an Envelope.
#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_EMPTY(head)
Check if an array is empty.
#define ARRAY_SIZE(head)
The number of elements stored.
#define ARRAY_FREE(head)
Release all memory.
#define ARRAY_GET(head, idx)
Return the element at index.
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
void mutt_actx_free(struct AttachCtx **ptr)
Free an Attachment Context.
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
GUI display the mailboxes in a side panel.
char * AutocryptDefaultKey
Autocrypt default key id (used for postponing messages)
Autocrypt end-to-end encryption.
int mutt_autocrypt_set_sign_as_default_key(struct Email *e)
Set the Autocrypt default key for signing.
Select a Mailbox from a list.
#define MUTT_SEL_NO_FLAGS
No flags are set.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
struct Buffer * buf_new(const char *str)
Allocate a new Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
GUI editor for an email's headers.
#define MUTT_COMPOSE_NOFREEHEADER
const struct Regex * cs_subset_regex(const struct ConfigSubset *sub, const char *name)
Get a regex config item by name.
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
const struct Slist * cs_subset_slist(const struct ConfigSubset *sub, const char *name)
Get a string-list config item by name.
enum QuadOption cs_subset_quad(const struct ConfigSubset *sub, const char *name)
Get a quad-value config item by name.
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path 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.
Convenience wrapper for the config headers.
int cs_str_initial_get(const struct ConfigSet *cs, const char *name, struct Buffer *result)
Get the initial, or parent, value of a config item.
int mutt_copy_message(FILE *fp_out, struct Email *e, struct Message *msg, CopyMessageFlags cmflags, CopyHeaderFlags chflags, int wraplen)
Copy a message from a Mailbox.
Duplicate the structure of an entire email.
#define CH_DECODE
Do RFC2047 header decoding.
#define MUTT_CM_WEED
Weed message/rfc822 attachment headers.
#define MUTT_CM_REPLYING
Replying the message.
#define MUTT_CM_PREFIX
Quote the header and body.
#define MUTT_CM_DECODE
Decode the message body into text/plain.
#define CH_WEED
Weed the headers?
#define CH_REORDER
Re-order output of headers (specified by 'hdr_order')
#define MUTT_CM_CHARCONV
Perform character set conversions.
uint32_t CopyHeaderFlags
Flags for mutt_copy_header(), e.g. CH_UPDATE.
#define MUTT_CM_NO_FLAGS
No flags are set.
#define MUTT_CM_NOHEADER
Don't copy the message header.
uint16_t CopyMessageFlags
Flags for mutt_copy_message(), e.g. MUTT_CM_NOHEADER.
Convenience wrapper for the core headers.
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
@ MUTT_IMAP
'IMAP' Mailbox type
void crypt_opportunistic_encrypt(struct Email *e)
Can all recipients be determined.
bool crypt_valid_passphrase(SecurityFlags flags)
Check that we have a usable passphrase, ask if not.
bool mutt_should_hide_protected_subject(struct Email *e)
Should NeoMutt hide the protected subject?
int mutt_protect(struct Email *e, char *keylist, bool postpone)
Encrypt and/or sign a message.
int crypt_get_keys(struct Email *e, char **keylist, bool oppenc_mode)
Check we have all the keys we need.
bool crypt_has_module_backend(SecurityFlags type)
Is there a crypto backend for a given type?
struct Body * crypt_pgp_make_key_attachment(void)
Wrapper for CryptModuleSpecs::pgp_make_key_attachment()
void mutt_edit_file(const char *editor, const char *file)
Let the user edit a file.
bool mutt_is_quote_line(char *line, regmatch_t *pmatch)
Is a line of message text a quote?
int mutt_make_string(struct Buffer *buf, size_t max_cols, const struct Expando *exp, struct Mailbox *m, int inpgr, struct Email *e, MuttFormatFlags flags, const char *progress)
Create formatted strings using mailbox expandos.
void mutt_body_free(struct Body **ptr)
Free a Body.
struct Body * mutt_body_new(void)
Create a new Body.
struct Email * email_new(void)
Create a new Email.
void email_free(struct Email **ptr)
Free an Email.
Structs that make up an email.
void mutt_parse_content_type(const char *s, struct Body *b)
Parse a content type.
bool mutt_parse_mailto(struct Envelope *env, char **body, const char *src)
Parse a mailto:// url.
char * mutt_extract_message_id(const char *s, size_t *len)
Find a message-id.
const char * mutt_get_name(const struct Address *a)
Pick the best name to display from an address.
int mutt_env_to_intl(struct Envelope *env, const char **tag, char **err)
Convert an Envelope's Address fields to Punycode format.
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
struct Envelope * mutt_env_new(void)
Create a new Envelope.
void mutt_env_set_subject(struct Envelope *env, const char *subj)
Set both subject and real_subj to subj.
void mutt_env_to_local(struct Envelope *env)
Convert an Envelope's Address fields to local format.
bool mutt_is_subscribed_list_recipient(bool all_addr, struct Envelope *env)
Matches subscribed mailing lists.
bool mutt_is_list_recipient(bool all_addr, struct Envelope *env)
Matches known mailing lists.
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 GreetingRenderCallbacks[]
Callbacks for Greeting Expandos.
Greeting Expando definitions.
char * msgid_generate(void)
Generate a Message-Id.
Message Id Expando definitions.
int mutt_file_copy_stream(FILE *fp_in, FILE *fp_out)
Copy the contents of one file into another.
long mutt_file_get_size_fp(FILE *fp)
Get the size of a file.
time_t mutt_file_decrease_mtime(const char *fp, struct stat *st)
Decrease a file's modification time by 1 second.
bool mutt_file_seek(FILE *fp, LOFF_T offset, int whence)
Wrapper for fseeko with error handling.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
void mutt_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
Set a flag on an email.
bool OptGui
(pseudo) when the gui (and curses) are started
struct ListHead UserHeader
List of custom headers to add to outgoing emails.
bool OptNewsSend
(pseudo) used to change behavior when posting
bool mutt_is_mail_list(const struct Address *addr)
Is this the email address of a mailing list?
int dlg_compose(struct Email *e, struct Buffer *fcc, uint8_t flags, struct ConfigSubset *sub)
Allow the user to edit the message envelope -.
int mw_enter_fname(const char *prompt, struct Buffer *fname, bool mailbox, struct Mailbox *m, bool multiple, char ***files, int *numfiles, SelectFileFlags flags)
Ask the user to select a file -.
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
int mw_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question -.
#define mutt_warning(...)
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox?
Convenience wrapper for the gui headers.
bool mutt_prefer_as_attachment(struct Body *b)
Do we want this part as an attachment?
Decide how to display email content.
Read/write command history from/to a file.
@ HC_OTHER
Miscellaneous strings.
void mutt_select_fcc(struct Buffer *path, struct Email *e)
Select the FCC path for an email.
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Parse and execute user-defined hooks.
#define MUTT_SEND_HOOK
send-hook: when composing a new email
#define MUTT_SEND2_HOOK
send2-hook: when changing fields in the compose menu
#define MUTT_REPLY_HOOK
reply-hook: when replying to an email
#define MUTT_MESSAGE_HOOK
message-hook: run before displaying a message
GUI manage the main index (list of emails)
void mutt_list_copy_tail(struct ListHead *dst, const struct ListHead *src)
Copy a list into another list.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
struct ListNode * mutt_list_find(const struct ListHead *h, const char *data)
Find a string in a List.
struct ListNode * mutt_list_insert_head(struct ListHead *h, char *s)
Insert a string at the beginning of a List.
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
@ LL_DEBUG5
Log at debug level 5.
@ LL_DEBUG1
Log at debug level 1.
#define MUTT_MEM_CALLOC(n, type)
#define MUTT_MEM_MALLOC(n, type)
@ TYPE_MULTIPART
Type: 'multipart/*'.
@ TYPE_APPLICATION
Type: 'application/*'.
@ TYPE_TEXT
Type: 'text/*'.
@ DISP_INLINE
Content is inline.
struct Body * mutt_remove_multipart(struct Body *b)
Extract the multipart body if it exists.
struct Body * mutt_make_multipart(struct Body *b)
Create a multipart email.
Manipulate multipart Emails.
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
Convenience wrapper for the library headers.
bool mutt_path_canon(struct Buffer *path, const char *homedir, bool is_dir)
Create the canonical version of a path.
bool mutt_regex_match(const struct Regex *regex, const char *str)
Shorthand to mutt_regex_capture()
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
char * mutt_str_dup(const char *str)
Copy a string, safely.
int mutt_str_asprintf(char **strp, const char *fmt,...)
char * mutt_str_skip_email_wsp(const char *s)
Skip over whitespace as defined by RFC5322.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Many unsorted constants and some structs.
#define MUTT_COMP_NO_FLAGS
No flags are set.
@ MUTT_REPLIED
Messages that have been replied to.
bool mutt_edit_attachment(struct Body *b)
Edit an attachment.
int mutt_body_copy(FILE *fp, struct Body **b_dst, struct Body *b_src)
Create a send-mode duplicate from a receive-mode body.
Representation of the body of an email.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
void mutt_sleep(short s)
Sleep for a while.
void buf_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
bool mutt_needs_mailcap(struct Body *b)
Does this type need a mailcap entry do display.
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
FILE * mutt_open_read(const char *path, pid_t *thepid)
Run a command to read from.
Some miscellaneous functions.
int mx_msg_close(struct Mailbox *m, struct Message **ptr)
Close a message.
struct Message * mx_msg_open(struct Mailbox *m, struct Email *e)
Return a stream pointer for a message.
API for encryption/signing of emails.
#define SEC_INLINE
Email has an inline signature.
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
#define SEC_NO_FLAGS
No flags are set.
#define SEC_ENCRYPT
Email is encrypted.
#define SEC_AUTOCRYPT_OVERRIDE
(Autocrypt) Indicates manual set/unset of encryption
#define SEC_SIGN
Email is signed.
Nntp-specific Mailbox data.
Notmuch virtual mailbox type.
int nm_record_message(struct Mailbox *m, char *path, struct Email *e)
Add a message to the Notmuch database.
void mutt_param_delete(struct ParameterList *pl, const char *attribute)
Delete a matching Parameter.
void mutt_param_set(struct ParameterList *pl, const char *attribute, const char *value)
Set a Parameter.
Match patterns to emails.
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.
int mutt_num_postponed(struct Mailbox *m, bool force)
Return the number of postponed messages.
void mutt_update_num_postponed(void)
Force the update of the number of postponed messages.
int mutt_get_postponed(struct Mailbox *m_cur, struct Email *hdr, struct Email **cur, struct Buffer *fcc)
Recall a postponed message.
int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *e_new, struct Email *e, bool resend)
Prepare a message template.
Prototypes for many functions.
QuadOption
Possible values for a quad-option.
@ MUTT_ABORT
User aborted the question (with Ctrl-G)
@ MUTT_ASKNO
Ask the user, defaulting to 'No'.
@ MUTT_NO
User answered 'No', or assume 'No'.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
enum QuadOption query_quadoption(const char *prompt, struct ConfigSubset *sub, const char *name)
Ask the user a quad-question.
enum QuadOption query_yesorno(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question.
#define TAILQ_FOREACH(var, head, field)
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
#define STAILQ_FIRST(head)
#define STAILQ_FOREACH(var, head, field)
#define TAILQ_FIRST(head)
#define STAILQ_EMPTY(head)
#define TAILQ_SWAP(head1, head2, type, field)
#define TAILQ_FOREACH_REVERSE(var, head, headname, field)
#define TAILQ_REMOVE(head, elm, field)
#define TAILQ_NEXT(elm, field)
#define TAILQ_EMPTY(head)
#define STAILQ_NEXT(elm, field)
void mutt_generate_recvattach_list(struct AttachCtx *actx, struct Email *e, struct Body *b, FILE *fp, int parent_type, int level, bool decrypted)
Create a list of attachments.
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
void rfc2047_encode(char **pd, const char *specials, int col, const struct Slist *charsets)
RFC-2047-encode a string.
void rfc2047_decode(char **pd)
Decode any RFC2047-encoded header fields.
void mutt_rfc3676_space_stuff(struct Email *e)
Perform RFC3676 space stuffing on an Email.
RFC3676 Format Flowed routines.
int mutt_write_mime_body(struct Body *b, FILE *fp, struct ConfigSubset *sub)
Write a MIME part.
Convenience wrapper for the send headers.
void mutt_make_misc_reply_headers(struct Envelope *env, struct Envelope *env_cur, struct ConfigSubset *sub)
Set subject for a reply.
static int postpone_message(struct Email *e_post, struct Email *e_cur, const char *fcc, SendFlags flags, struct ConfigSubset *sub)
Save an Email for another day.
static int include_reply(struct Mailbox *m, struct Email *e, FILE *fp_out, struct ConfigSubset *sub)
Generate the reply text for an email.
static bool is_reply(struct Email *reply, struct Email *orig)
Is one email a reply to another?
void mutt_encode_descriptions(struct Body *b, bool recurse, struct ConfigSubset *sub)
RFC2047 encode the content-descriptions.
void mutt_make_attribution_intro(struct Email *e, FILE *fp_out, struct ConfigSubset *sub)
Add "on DATE, PERSON wrote" header.
static int save_fcc(struct Mailbox *m, struct Email *e, struct Buffer *fcc, struct Body *clear_content, char *pgpkeylist, SendFlags flags, char **finalpath, struct ConfigSubset *sub)
Save an Email to a 'sent mail' folder.
static int envelope_defaults(struct Envelope *env, struct EmailArray *ea, SendFlags flags, struct ConfigSubset *sub)
Fill in some defaults for a new email.
int mutt_edit_address(struct AddressList *al, const char *field, bool expand_aliases)
Edit an email address.
void mutt_forward_intro(struct Email *e, FILE *fp, struct ConfigSubset *sub)
Add the "start of forwarded message" text.
void mutt_make_forward_subject(struct Envelope *env, struct Email *e, struct ConfigSubset *sub)
Create a subject for a forwarded email.
static void make_reference_headers(struct EmailArray *ea, struct Envelope *env, struct ConfigSubset *sub)
Generate reference headers for an email.
static const struct AddressList * choose_default_to(const struct Address *from, const struct Envelope *env, struct ConfigSubset *sub)
Pick the best 'to:' value.
void mutt_fix_reply_recipients(struct Envelope *env, struct ConfigSubset *sub)
Remove duplicate recipients.
static char * nntp_get_header(const char *s)
Get the trimmed header.
int mutt_resend_message(FILE *fp, struct Mailbox *m, struct Email *e_cur, struct ConfigSubset *sub)
Resend an email.
static int include_forward(struct Mailbox *m, struct Email *e, FILE *fp_out, struct ConfigSubset *sub)
Write out a forwarded message.
static int generate_body(FILE *fp_tmp, struct Email *e, SendFlags flags, struct Mailbox *m, struct EmailArray *ea, struct ConfigSubset *sub)
Create a new email body.
static void remove_user(struct AddressList *al, bool leave_only)
Remove any address which matches the current user.
static void add_message_id(struct ListHead *head, struct Envelope *env)
Add the email's message ID to a list.
static void add_mailing_lists(struct AddressList *out, const struct AddressList *t, const struct AddressList *c)
Search Address lists for mailing lists.
int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, SendFlags flags, struct ConfigSubset *sub)
Generate recpients for a reply email.
static void mutt_make_greeting(struct Email *e, FILE *fp_out, struct ConfigSubset *sub)
Add greetings string.
static int invoke_mta(struct Mailbox *m, struct Email *e, struct ConfigSubset *sub)
Send an email.
struct Address * mutt_default_from(struct ConfigSubset *sub)
Get a default 'from' Address.
static void process_user_recips(struct Envelope *env)
Process the user headers.
bool mutt_send_list_unsubscribe(struct Mailbox *m, struct Email *e)
Send a mailing-list unsubscription email.
static void format_attribution(const struct Expando *exp, struct Email *e, FILE *fp_out, struct ConfigSubset *sub)
Format an attribution prefix/suffix.
static void process_user_header(struct Envelope *env)
Process the user headers.
static int edit_envelope(struct Envelope *en, SendFlags flags, struct ConfigSubset *sub)
Edit Envelope fields.
static bool send_simple_email(struct Mailbox *m, struct EmailArray *ea, const char *mailto, const char *subj, const char *body)
Compose an email given a few basic ingredients.
static bool abort_for_missing_attachments(const struct Body *b, struct ConfigSubset *sub)
Should we abort sending because of missing attachments?
static int default_to(struct AddressList *to, struct Envelope *env, SendFlags flags, int hmfupto, struct ConfigSubset *sub)
Generate default email addresses.
static void set_reverse_name(struct AddressList *al, struct Envelope *env, struct ConfigSubset *sub)
Try to set the 'from' field from the recipients.
static void fix_end_of_file(const char *data)
Ensure a file ends with a linefeed.
static bool search_attach_keyword(char *filename, struct ConfigSubset *sub)
Search an email for 'attachment' keywords.
void mutt_forward_trailer(struct Email *e, FILE *fp, struct ConfigSubset *sub)
Add a "end of forwarded message" text.
int mutt_send_message(SendFlags flags, struct Email *e_templ, const char *tempfile, struct Mailbox *m, struct EmailArray *ea, struct ConfigSubset *sub)
Send an email.
static bool is_text_plain(const struct Body *b)
Is a Body a text/plain MIME part?
static int inline_forward_attachments(struct Mailbox *m, struct Email *e, struct Body ***plast, enum QuadOption *forwardq, struct ConfigSubset *sub)
Add attachments to an email, inline.
bool mutt_send_list_subscribe(struct Mailbox *m, struct Email *e)
Send a mailing-list subscription email.
static void add_references(struct ListHead *head, struct Envelope *env)
Add the email's references to a list.
static void decode_descriptions(struct Body *b)
RFC2047 decode them in case of an error.
void mutt_make_attribution_trailer(struct Email *e, FILE *fp_out, struct ConfigSubset *sub)
Add suffix to replied email text.
void mutt_set_followup_to(struct Envelope *env, struct ConfigSubset *sub)
Set followup-to field.
static void append_signature(FILE *fp, struct ConfigSubset *sub)
Append a signature to an email.
void mutt_add_to_reference_headers(struct Envelope *env, struct Envelope *env_cur, struct ConfigSubset *sub)
Generate references for a reply email.
Prepare and send an email.
#define SEND_POSTPONED_FCC
Used by mutt_get_postponed() to signal that the Mutt-Fcc header field was present.
#define SEND_BATCH
Send email in batch mode (without user interaction)
#define SEND_GROUP_CHAT_REPLY
Reply to all recipients preserving To/Cc.
#define SEND_NO_FREE_HEADER
Used by the -E flag.
#define SEND_DRAFT_FILE
Used by the -H flag.
uint32_t SendFlags
Flags for mutt_send_message(), e.g. SEND_REPLY.
#define SEND_GROUP_REPLY
Reply to all.
#define SEND_LIST_REPLY
Reply to mailing list.
#define SEND_KEY
Mail a PGP public key.
#define SEND_POSTPONED
Recall a postponed email.
#define SEND_CONSUMED_STDIN
stdin has been read; don't read it twice
#define SEND_TO_SENDER
Compose new email to sender.
#define SEND_CLI_CRYPTO
Enable message security in modes that by default don't enable it.
#define SEND_RESEND
Reply using the current email as a template.
#define SEND_REPLY
Reply to sender.
#define SEND_REVIEW_TO
Allow the user to edit the To field.
#define SEND_NEWS
Reply to a news article.
#define SEND_FORWARD
Forward email.
void mutt_update_encoding(struct Body *b, struct ConfigSubset *sub)
Update the encoding type.
const char * mutt_fqdn(bool may_hide_host, const struct ConfigSubset *sub)
Get the Fully-Qualified Domain Name.
int mutt_write_multiple_fcc(const char *path, struct Email *e, const char *msgid, bool post, char *fcc, char **finalpath, struct ConfigSubset *sub)
Handle FCC with multiple, comma separated entries.
void mutt_unprepare_envelope(struct Envelope *env)
Undo the encodings of mutt_prepare_envelope()
void mutt_prepare_envelope(struct Envelope *env, bool final, struct ConfigSubset *sub)
Prepare an email header.
struct Body * mutt_make_message_attach(struct Mailbox *m, struct Email *e, bool attach_msg, struct ConfigSubset *sub)
Create a message attachment.
int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, bool post, const char *fcc, char **finalpath, struct ConfigSubset *sub)
Write email to FCC mailbox.
Miscellaneous functions for sending an email.
int mutt_invoke_sendmail(struct Mailbox *m, struct AddressList *from, struct AddressList *to, struct AddressList *cc, struct AddressList *bcc, const char *msg, bool eightbit, struct ConfigSubset *sub)
Run sendmail.
Send email using sendmail.
int mutt_smtp_send(const struct AddressList *from, const struct AddressList *to, const struct AddressList *cc, const struct AddressList *bcc, const char *msgfile, bool eightbit, struct ConfigSubset *sub)
Send a message using SMTP.
Send email to an SMTP server.
struct Buffer * personal
Real name of address.
struct Buffer * mailbox
Mailbox and host address.
FILE * fp_root
Used by recvattach for updating.
struct Email * email
Used by recvattach for updating.
struct AttachPtr ** idx
Array of attachments.
short idxlen
Number of attachmentes.
struct Body * body
Attachment.
FILE * fp
Used in the recvattach menu.
struct Body * parts
parts of a multipart or message/rfc822
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
struct Envelope * mime_headers
Memory hole protected headers.
struct ParameterList parameter
Parameters of the content-type.
bool use_disp
Content-Disposition uses filename= ?
unsigned int disposition
content-disposition, ContentDisposition
struct Body * next
next attachment in the list
char * subtype
content-type subtype
unsigned int encoding
content-transfer-encoding, ContentEncoding
unsigned int type
content-type primary type, ContentType
char * filename
When sending a message, this is the file to which this structure refers.
String manipulation buffer.
size_t dsize
Length of data.
A set of inherited config items.
struct ConfigSet * cs
Parent ConfigSet.
The envelope/body of an email.
struct Envelope * env
Envelope information.
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
struct Body * body
List of MIME parts.
bool old
Email is seen, but unread.
bool replied
Email has been replied to.
time_t received
Time when the message was placed in the mailbox.
struct ListHead userhdrs
user defined headers
char * list_subscribe
This stores a mailto URL, or nothing.
char *const subject
Email's subject.
struct AddressList to
Email's 'To' list.
char * followup_to
List of 'followup-to' fields.
struct AddressList reply_to
Email's 'reply-to'.
char * message_id
Message ID.
char * x_comment_to
List of 'X-comment-to' fields.
struct AddressList x_original_to
Email's 'X-Original-to'.
char * newsgroups
List of newsgroups.
struct AddressList mail_followup_to
Email's 'mail-followup-to'.
struct AddressList cc
Email's 'Cc' list.
struct ListHead references
message references (in reverse order)
struct ListHead in_reply_to
in-reply-to header content
struct AddressList bcc
Email's 'Bcc' list.
char * list_post
This stores a mailto URL, or nothing.
char *const real_subj
Offset of the real subject.
char * list_unsubscribe
This stores a mailto URL, or nothing.
struct AddressList from
Email's 'From' list.
enum MailboxType type
Mailbox type.
void * mdata
Driver specific data.
A local copy of an email.
FILE * fp
pointer to the message data
Container for Accounts, Notifications.
char ** env
Private copy of the environment variables.
char * username
User's login name.
char * home_dir
User's home directory.
struct ConfigSubset * sub
Inherited config items.
NNTP-specific Mailbox data -.
Cached regular expression.
regex_t * regex
compiled expression
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
int cs_subset_str_string_set(const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err)
Set a config item by string.