Go to the documentation of this file.
82 char *buf,
size_t buflen)
100 for (; buflen; buf++, buflen--)
147 else if ((ch ==
'\t') || (ch ==
'\f'))
157 else if ((ch < 32) || (ch == 127))
163 if ((ch ==
'F') || (ch ==
'f'))
174 if ((linelen == 2) && (ch !=
'r'))
176 else if ((linelen == 3) && (ch !=
'o'))
178 else if (linelen == 4)
192 if ((ch !=
' ') && (ch !=
'\t'))
229 char const *
const *tocodes,
int *tocode,
struct Content *info)
231 char bufi[256], bufu[512], bufo[4 *
sizeof(bufi)];
235 if (cd1 == (iconv_t)(-1))
243 for (
int i = 0; i < ncodes; i++)
250 cd[i] = (iconv_t)(-1);
251 score[i] = (size_t)(-1);
260 size_t n = fread(bufi + ibl, 1,
sizeof(bufi) - ibl, fp);
264 const char *ib = bufi;
266 size_t obl =
sizeof(bufu);
267 n = iconv(cd1, (ICONV_CONST
char **) ((ibl != 0) ? &ib : 0), &ibl, &ob, &obl);
269 if ((n == (
size_t)(-1)) && (((errno != EINVAL) && (errno != E2BIG)) || (ib == bufi)))
275 const size_t ubl1 = ob - bufu;
278 for (
int i = 0; i < ncodes; i++)
280 if ((cd[i] != (iconv_t)(-1)) && (score[i] != (size_t)(-1)))
282 const char *ub = bufu;
286 n = iconv(cd[i], (ICONV_CONST
char **) ((ibl || ubl) ? &ub : 0), &ubl, &ob, &obl);
287 if (n == (
size_t)(-1))
290 score[i] = (size_t)(-1);
298 else if ((cd[i] == (iconv_t)(-1)) && (score[i] == (
size_t)(-1)))
308 memmove(bufi, ib, ibl);
310 else if (!ubl1 && (ib < bufi +
sizeof(bufi)))
321 for (
int i = 0; i < ncodes; i++)
323 if ((cd[i] == (iconv_t)(-1)) && (score[i] == (size_t)(-1)))
330 else if ((cd[i] == (iconv_t)(-1)) || (score[i] == (size_t)(-1)))
332 else if ((ret == (
size_t)(-1)) || (score[i] < ret))
340 if (ret != (
size_t)(-1))
342 memcpy(info, &infos[*tocode],
sizeof(
struct Content));
347 for (
int i = 0; i < ncodes; i++)
348 if (cd[i] != (iconv_t)(-1))
382 char **fromcode,
char **tocode,
struct Content *info)
386 const char *c = NULL, *c1 = NULL;
392 for (c = tocodes; c; c = c1 ? c1 + 1 : 0)
402 for (c = tocodes, i = 0; c; c = c1 ? c1 + 1 : 0, i++)
417 for (c = fromcodes; c; c = c1 ? c1 + 1 : 0)
427 ret =
convert_file_to(fp, fcode, ncodes, (
char const *
const *) tcode, &cn, info);
428 if (ret != (
size_t)(-1))
441 ret =
convert_file_to(fp, fromcodes, ncodes, (
char const *
const *) tcode, &cn, info);
442 if (ret != (
size_t)(-1))
450 for (i = 0; i < ncodes; i++)
473 char *fromcode = NULL;
485 if (stat(fname, &sb) == -1)
487 mutt_error(
_(
"Can't stat %s: %s"), fname, strerror(errno));
491 if (!S_ISREG(sb.st_mode))
497 fp = fopen(fname,
"r");
515 b->
use_disp ? (c_attach_charset ? c_attach_charset : c_charset) : c_charset;
516 if (c_charset && (
chs || c_send_charset) &&
518 &tocode, info) != (size_t)(-1)))
535 while ((r = fread(buf, 1,
sizeof(buf), fp)))
544 (!info->
hibin ?
"us-ascii" :
568 char *p = NULL, *q = NULL, *ct = NULL;
570 char subtype[256] = { 0 };
571 char xtype[256] = { 0 };
572 int sze, cur_sze = 0;
573 bool found_mimetypes =
false;
578 for (
int count = 0; count < 4; count++)
596 snprintf(buf,
sizeof(buf),
"%s/.mime.types",
NONULL(
HomeDir));
603 fp = fopen(buf,
"r");
606 found_mimetypes =
true;
608 while (fgets(buf,
sizeof(buf) - 1, fp))
611 p = strchr(buf,
'#');
620 p = strpbrk(ct,
" \t");
627 while ((p = strtok(p,
" \t\n")))
630 if ((sze > cur_sze) && (szf >= sze) &&
mutt_istr_equal(path + szf - sze, p) &&
631 ((szf == sze) || (path[szf - sze - 1] ==
'.')))
643 for (q = p; *q && !
IS_SPACE(*q); q++)
664 if (!found_mimetypes)
666 mutt_error(
_(
"Could not find any mime.types file"));
687 struct Buffer *buf = NULL;
688 struct State s = { 0 };
691 for (; a; a = a->
next)
783 fseeko(fp_in, a->
offset, SEEK_SET);
791 fputs(
"MIME-Version: 1.0\n", fp_out);
817 if (fp_in && (fp_in != fp))
841 char send_charset[128];
844 (info->
linemax > 990) || (info->
from && c_encode_from))
848 else if (info->
hibin)
861 if (c_allow_8bit && !info->
lobin)
940 struct Body *body = NULL;
945 const bool c_mime_forward_decode =
cs_subset_bool(sub,
"mime_forward_decode");
946 const bool c_forward_decrypt =
cs_subset_bool(sub,
"forward_decrypt");
982 if (!attach_msg && c_mime_forward_decode)
1043 FILE *fp = NULL, *fp_err = NULL;
1049 const char *c_mime_type_query_command =
1066 if (strchr(buf,
'/'))
1088 const char *c_mime_type_query_command =
1090 const bool c_mime_type_query_first =
1093 if (c_mime_type_query_command && c_mime_type_query_first)
1101 if (!att->
subtype && c_mime_type_query_command && !c_mime_type_query_first)
1115 if ((info->
nulbin == 0) &&
1153 p = strchr(np->
data,
':');
1167 sprintf(np->
data + i + 2,
"%s", tmp);
1185 if (!c_hostname || (c_hostname[0] ==
'@'))
1188 const char *p = c_hostname;
1191 if (may_hide_host && c_hidden_host)
1193 p = strchr(c_hostname,
'.');
1198 if (!p || !strchr(p,
'.'))
1218 const char *fqdn =
mutt_fqdn(
false, sub);
1223 snprintf(buf,
sizeof(buf),
"<%d%02d%02d%02d%02d%02d.%s@%s>", tm.tm_year + 1900,
1224 tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, rndid, fqdn);
1304 struct AddressList *to,
const char *resent_from,
1305 struct AddressList *env_from,
struct ConfigSubset *sub)
1319 const bool c_bounce_delivered =
cs_subset_bool(sub,
"bounce_delivered");
1320 if (!c_bounce_delivered)
1323 fseeko(fp, e->
offset, SEEK_SET);
1324 fprintf(fp_tmp,
"Resent-From: %s\n", resent_from);
1332 fprintf(fp_tmp,
"Resent-Message-ID: %s\n", msgid_str);
1334 fputs(
"Resent-To: ", fp_tmp);
1337 fputc(
'\n', fp_tmp);
1380 const char *fqdn =
mutt_fqdn(
true, sub);
1381 char resent_from[256];
1384 resent_from[0] =
'\0';
1405 mutt_error(
_(
"Bad IDN %s while preparing resent-from"), err);
1422 int rc =
bounce_message(fp, m, e, &resent_to, resent_from, &from_list, sub);
1436 for (; b; b = b->
next)
1470 char *tok = strtok(fcc_tok,
",");
1476 int status =
mutt_write_fcc(tok, e, msgid, post, fcc, finalpath, sub);
1480 while ((tok = strtok(NULL,
",")))
1490 status =
mutt_write_fcc(fcc_expanded, e, msgid, post, fcc, finalpath, sub);
1511 const char *fcc,
char **finalpath,
struct ConfigSubset *sub)
1514 struct Buffer *tempfile = NULL;
1515 FILE *fp_tmp = NULL;
1517 bool need_mailbox_cleanup =
false;
1524 #ifdef RECORD_FOLDER_HOOK
1528 bool old_append = m_fcc->
append;
1551 need_mailbox_cleanup =
true;
1567 const bool c_crypt_protected_headers_read =
1583 fprintf(msg->
fp,
"X-Mutt-References: %s\n", msgid);
1588 fprintf(msg->
fp,
"X-Mutt-Fcc: %s\n", fcc);
1591 fprintf(msg->
fp,
"Status: RO\n");
1596 fputs(
"X-Mutt-PGP: ", msg->
fp);
1598 fputc(
'E', msg->
fp);
1600 fputc(
'O', msg->
fp);
1603 fputc(
'S', msg->
fp);
1607 fprintf(msg->
fp,
"<%s>", c_pgp_sign_as);
1610 fputc(
'I', msg->
fp);
1611 #ifdef USE_AUTOCRYPT
1613 fputc(
'A', msg->
fp);
1615 fputc(
'Z', msg->
fp);
1617 fputc(
'\n', msg->
fp);
1623 fputs(
"X-Mutt-SMIME: ", msg->
fp);
1626 fputc(
'E', msg->
fp);
1628 const char *c_smime_encrypt_with =
1630 if (c_smime_encrypt_with)
1631 fprintf(msg->
fp,
"C<%s>", c_smime_encrypt_with);
1634 fputc(
'O', msg->
fp);
1637 fputc(
'S', msg->
fp);
1640 if (c_smime_sign_as)
1641 fprintf(msg->
fp,
"<%s>", c_smime_sign_as);
1644 fputc(
'I', msg->
fp);
1645 fputc(
'\n', msg->
fp);
1654 fputs(
"X-Mutt-Mix:", msg->
fp);
1658 fprintf(msg->
fp,
" %s", (
char *) p->
data);
1661 fputc(
'\n', msg->
fp);
1671 fseek(fp_tmp, -1, SEEK_END);
1672 if (fgetc(fp_tmp) !=
'\n')
1674 fseek(fp_tmp, 0, SEEK_END);
1675 fputc(
'\n', fp_tmp);
1692 char line_buf[1024];
1694 while (fgets(line_buf,
sizeof(line_buf), fp_tmp))
1696 fprintf(msg->
fp,
"Content-Length: " OFF_T_FMT
"\n", (LOFF_T) ftello(fp_tmp));
1697 fprintf(msg->
fp,
"Lines: %d\n\n", lines);
1713 fputc(
'\n', msg->
fp);
1724 if (!post && need_mailbox_cleanup)
1732 m_fcc->
append = old_append;
1733 #ifdef RECORD_FOLDER_HOOK
int mutt_file_copy_bytes(FILE *fp_in, FILE *fp_out, size_t size)
Copy some content from one file to another.
uint32_t CopyHeaderFlags
Flags for mutt_copy_header(), e.g. CH_UPDATE.
struct AddressList bcc
Email's 'Bcc' list.
@ ENC_QUOTED_PRINTABLE
Quoted-printable text.
static void update_content_info(struct Content *info, struct ContentState *s, char *buf, size_t buflen)
Cache some info about an email.
bool noconv
Don't do character set conversion.
@ MUTT_MMDF
'mmdf' Mailbox type
FILE * fp_in
File to read from.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
void mutt_stamp_attachment(struct Body *a)
Timestamp an Attachment.
#define MUTT_CM_CHARCONV
Perform character set conversions.
void rfc2047_encode_envelope(struct Envelope *env)
Encode the fields of an Envelope.
void mutt_ch_canonical_charset(char *buf, size_t buflen, const char *name)
Canonicalise the charset of a string.
char * message_id
Message ID.
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
struct Content * content
Detailed info about the content of the attachment.
bool append
Mailbox is opened in append mode.
void mutt_addrlist_qualify(struct AddressList *al, const char *host)
Expand local names in an Address list using a hostname.
bool dot
Has a line consisting of a single dot?
#define CH_NONEWLINE
Don't output terminating newline after the header.
void mutt_date_make_date(struct Buffer *buf)
Write a date in RFC822 format to a buffer.
char * personal
Real name of address.
String manipulation buffer.
void mutt_addrlist_append(struct AddressList *al, struct Address *a)
Append an Address to an AddressList.
static void encode_headers(struct ListHead *h, struct ConfigSubset *sub)
RFC2047-encode a list of headers.
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
LOFF_T offset
offset where the actual data begins
struct Mailbox * ctx_mailbox(struct Context *ctx)
wrapper to get the mailbox in a Context, or NULL
void mutt_update_encoding(struct Body *a, struct ConfigSubset *sub)
Update the encoding type.
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
#define SEC_AUTOCRYPT_OVERRIDE
(Autocrypt) Indicates manual set/unset of encryption
struct Body * next
next attachment in the list
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
void mutt_mailbox_cleanup(const char *path, struct stat *st)
Restore the timestamp of a mailbox.
#define SEC_ENCRYPT
Email is encrypted.
#define SEC_SIGN
Email is signed.
#define MUTT_ICONV_NO_FLAGS
No flags are set.
size_t mutt_addrlist_write(const struct AddressList *al, char *buf, size_t buflen, bool display)
Write an Address to a buffer.
#define mutt_buffer_mktemp(buf)
void mutt_folder_hook(const char *path, const char *desc)
Perform a folder hook.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
bool from
Has a line beginning with "From "?
#define TAILQ_EMPTY(head)
LOFF_T offset
Where in the stream does this message begin?
long linemax
Length of the longest line in the file.
void mutt_prepare_envelope(struct Envelope *env, bool final, struct ConfigSubset *sub)
Prepare an email header.
char * mutt_str_dup(const char *str)
Copy a string, safely.
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
void mutt_file_unlink(const char *s)
Delete a file, carefully.
@ LL_DEBUG1
Log at debug level 1.
enum ContentType mutt_check_mime_type(const char *s)
Check a MIME type string.
bool mutt_should_hide_protected_subject(struct Email *e)
Should NeoMutt hide the protected subject?
long hibin
8-bit characters
unsigned int disposition
content-disposition, ContentDisposition
unsigned int encoding
content-transfer-encoding, ContentEncoding
long lobin
Unprintable 7-bit chars (eg., control chars)
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
long nulbin
Null characters (0x0)
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
bool space
Whitespace at the end of lines?
#define STAILQ_EMPTY(head)
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
#define MUTT_CM_DECODE_PGP
Used for decoding PGP messages.
struct Email * email_new(void)
Create a new Email.
void mutt_body_free(struct Body **ptr)
Free a Body.
char * subtype
content-type subtype
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
void rfc2047_decode_envelope(struct Envelope *env)
Decode the fields of an Envelope.
#define STAILQ_FOREACH(var, head, field)
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.
FILE * fp_out
File to write to.
int mutt_bounce_message(FILE *fp, struct Mailbox *m, struct Email *e, struct AddressList *to, struct ConfigSubset *sub)
Bounce an email message.
char * mutt_strn_copy(char *dest, const char *src, size_t len, size_t dsize)
Copy a sub-string into a buffer.
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.
void mutt_parse_mime_message(struct Mailbox *m, struct Email *e)
Parse a MIME email.
iconv_t mutt_ch_iconv_open(const char *tocode, const char *fromcode, uint8_t flags)
Set up iconv for conversions.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
void mutt_unprepare_envelope(struct Envelope *env)
Undo the encodings of mutt_prepare_envelope()
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 rfc2047_encode_addrlist(struct AddressList *al, const char *tag)
Encode any RFC2047 headers, where required, in an Address list.
static char * gen_msgid(struct ConfigSubset *sub)
Generate a unique Message ID.
#define TAILQ_HEAD_INITIALIZER(head)
const char AddressSpecials[]
Characters with special meaning for email addresses.
#define MUTT_RL_NO_FLAGS
No flags are set.
char * committed_path
the final path generated by mx_msg_commit()
void mutt_parse_content_type(const char *s, struct Body *ct)
Parse a content type.
void mutt_buffer_file_expand_fmt_quote(struct Buffer *dest, const char *fmt, const char *src)
Replace s in a string with a filename.
pid_t filter_create(const char *cmd, FILE **fp_in, FILE **fp_out, FILE **fp_err)
Set up filter program.
struct AddressList cc
Email's 'Cc' list.
#define CH_WEED_DELIVERED
Weed eventual Delivered-To headers.
struct Body * mutt_body_new(void)
Create a new Body.
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
static int bounce_message(FILE *fp, struct Mailbox *m, struct Email *e, struct AddressList *to, const char *resent_from, struct AddressList *env_from, struct ConfigSubset *sub)
Bounce an email message.
SecurityFlags mutt_is_application_pgp(struct Body *m)
Does the message use PGP?
char * xtype
content-type if x-unknown
enum MailboxType type
Mailbox type.
int mx_msg_commit(struct Mailbox *m, struct Message *msg)
Commit a message to a folder - Wrapper for MxOps::msg_commit()
bool binary
Long lines, or CR not in CRLF pair.
struct Body * mutt_make_file_attach(const char *path, struct ConfigSubset *sub)
Create a file attachment.
int mutt_file_copy_stream(FILE *fp_in, FILE *fp_out)
Copy the contents of one file into another.
bool force_charset
Send mode: don't adjust the character set when in send-mode.
SecurityFlags mutt_is_multipart_encrypted(struct Body *b)
Does the message have encrypted parts?
void rfc2047_decode(char **pd)
Decode any RFC2047-encoded header fields.
enum MxStatus mx_mbox_close(struct Context **ptr)
Save changes and close mailbox.
int mutt_write_mime_body(struct Body *a, FILE *fp, struct ConfigSubset *sub)
Write a MIME part.
LOFF_T length
length (in bytes) of attachment
Info about the body of an email.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
#define MUTT_CM_NO_FLAGS
No flags are set.
struct Body * mutt_make_message_attach(struct Mailbox *m, struct Email *e, bool attach_msg, struct ConfigSubset *sub)
Create a message attachment.
char * mutt_str_skip_email_wsp(const char *s)
Skip over whitespace as defined by RFC5322.
char * mutt_body_get_charset(struct Body *b, char *buf, size_t buflen)
Get a body's character set.
void rfc2047_encode(char **pd, const char *specials, int col, const char *charsets)
RFC-2047-encode a string.
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
int mutt_copy_hdr(FILE *fp_in, FILE *fp_out, LOFF_T off_start, LOFF_T off_end, CopyHeaderFlags chflags, const char *prefix, int wraplen)
Copy header from one file to another.
#define mutt_ch_is_us_ascii(str)
void mutt_param_set(struct ParameterList *pl, const char *attribute, const char *value)
Set a Parameter.
bool mutt_is_message_type(int type, const char *subtype)
Determine if a mime type matches a message or not.
struct AddressList to
Email's 'To' list.
struct Body * parts
parts of a multipart or message/rfc822
@ TYPE_MESSAGE
Type: 'message/*'.
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
struct Envelope * env
Envelope information.
long ascii
Number of ascii chars.
char * charset
Send mode: charset of attached file as stored on disk.
#define mutt_debug(LEVEL,...)
int mutt_copy_header(FILE *fp_in, struct Email *e, FILE *fp_out, CopyHeaderFlags chflags, const char *prefix, int wraplen)
Copy Email header.
#define MUTT_ADD_FROM
add a From_ line
FILE * fp
pointer to the message data
#define MUTT_QUIET
Do not print any messages.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
struct Address * mutt_addr_new(void)
Create a new Address.
struct ListHead chain
Mixmaster chain.
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
time_t mutt_date_epoch(void)
Return the number of seconds since the Unix epoch.
#define MUTT_DATE_NOW
Constant representing the 'current time', see: mutt_date_gmtime(), mutt_date_localtime()
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
void mutt_param_delete(struct ParameterList *pl, const char *attribute)
Delete a matching Parameter.
char * mailbox
Mailbox and host address.
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
#define CH_NOQFROM
Ignore ">From " line.
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
struct ListHead userhdrs
user defined headers
@ TYPE_APPLICATION
Type: 'application/*'.
Keep track when processing files.
static void transform_to_7bit(struct Body *a, FILE *fp_in, struct ConfigSubset *sub)
Convert MIME parts to 7-bit.
char * d_filename
filename to be used for the content-disposition header.
char * HomeDir
User's home directory.
long crlf
\r and \n characters
time_t stamp
Time stamp of last encoding update.
@ ENC_BASE64
Base-64 encoded text.
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
uint8_t MsgOpenFlags
Flags for mx_msg_open_new(), e.g. MUTT_ADD_FROM.
WHERE char * ShortHostname
Short version of the hostname.
@ TYPE_TEXT
Type: 'text/*'.
char * mutt_strn_dup(const char *begin, size_t len)
Duplicate a sub-string.
@ DISP_INLINE
Content is inline.
#define SEC_INLINE
Email has an inline signature.
static void set_noconv_flags(struct Body *b, bool flag)
Set/reset the "x-mutt-noconv" flag.
bool cr
Has CR, even when in a CRLF pair.
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
Info about an attachment.
unsigned int type
content-type primary type, ContentType
struct tm mutt_date_gmtime(time_t t)
Converts calendar time to a broken-down time structure expressed in UTC timezone.
struct Context * mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
@ TYPE_OTHER
Unknown Content-Type.
void mutt_addr_cat(char *buf, size_t buflen, const char *value, const char *specials)
Copy a string and wrap it in quotes if it contains special characters.
void mutt_addrlist_write_file(const struct AddressList *al, FILE *fp, int start_col, bool display)
Wrapper for mutt_write_address()
struct Address * mutt_default_from(struct ConfigSubset *sub)
Get a default 'from' Address.
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
parses an RFC822 header
#define MUTT_CM_DECODE
Decode the message body into text/plain.
bool use_disp
Content-Disposition uses filename= ?
static void set_encoding(struct Body *b, struct Content *info, struct ConfigSubset *sub)
determine which Content-Transfer-Encoding to use
WHERE bool OptNewsSend
(pseudo) used to change behavior when posting
#define CH_MIME
Ignore MIME fields.
#define CH_TXTPLAIN
Generate text/plain MIME headers.
struct Email * email
header information for message/rfc822
char * mutt_buffer_strdup(const struct Buffer *buf)
Copy a Buffer's string.
void mutt_rand_base32(char *buf, size_t buflen)
Fill a buffer with a base32-encoded random string.
void mutt_set_followup_to(struct Envelope *env, struct ConfigSubset *sub)
Set followup-to field.
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
#define MUTT_APPEND
Open mailbox for appending messages.
struct ParameterList parameter
parameters of the content-type
void mutt_decode_attachment(struct Body *b, struct State *s)
Decode an email's attachment.
const char * mutt_fqdn(bool may_hide_host, const struct ConfigSubset *sub)
Get the Fully-Qualified Domain Name.
int mx_msg_close(struct Mailbox *m, struct Message **msg)
Close a message.
A set of inherited config items.
@ TYPE_MULTIPART
Type: 'multipart/*'.
The envelope/body of an email.
static size_t convert_file_to(FILE *fp, const char *fromcode, int ncodes, char const *const *tocodes, int *tocode, struct Content *info)
Change the encoding of a file.
#define MUTT_SET_DRAFT
set the message draft flag
struct Message * mx_msg_open_new(struct Mailbox *m, const struct Email *e, MsgOpenFlags flags)
Open a new message.
static size_t convert_file_from_to(FILE *fp, const char *fromcodes, const char *tocodes, char **fromcode, char **tocode, struct Content *info)
Convert a file between encodings.
enum ContentType mutt_lookup_mime_type(struct Body *att, const char *path)
Find the MIME type for an attachment.
struct AddressList mail_followup_to
Email's 'mail-followup-to'.
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.
void mutt_addrlist_copy(struct AddressList *dst, const struct AddressList *src, bool prune)
Copy a list of addresses into another list.
int mutt_copy_message(FILE *fp_out, struct Mailbox *m, struct Email *e, CopyMessageFlags cmflags, CopyHeaderFlags chflags, int wraplen)
Copy a message from a Mailbox.
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
bool crypt_valid_passphrase(SecurityFlags flags)
Check that we have a usable passphrase, ask if not.
#define SEC_NO_FLAGS
No flags are set.
@ MUTT_MBOX
'mbox' Mailbox type
static void run_mime_type_query(struct Body *att, struct ConfigSubset *sub)
Run an external command to determine the MIME type.
SecurityFlags mutt_is_application_smime(struct Body *m)
Does the message use S/MIME?
void mutt_message_to_7bit(struct Body *a, FILE *fp, struct ConfigSubset *sub)
Convert an email's MIME parts to 7-bit.
struct Content * mutt_get_content_info(const char *fname, struct Body *b, struct ConfigSubset *sub)
Analyze file to determine MIME encoding to use.
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
A local copy of an email.
struct Body * mutt_rfc822_parse_message(FILE *fp, struct Body *parent)
parse a Message/RFC822 body
char * filename
when sending a message, this is the file to which this structure refers
#define CH_XMIT
Transmitting this message? (Ignore Lines: and Content-Length:)
struct Body * body
List of MIME parts.
uint16_t CopyMessageFlags
Flags for mutt_copy_message(), e.g. MUTT_CM_NOHEADER.
char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, ReadLineFlags flags)
Read a line from a file.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)