index_mail_parse_header_init(mail, headers);
- if (data->parts == NULL || data->save_bodystructure_header) {
+ if (data->parts == NULL || data->save_bodystructure_header ||
+ (data->access_part & PARSE_BODY) != 0) {
/* initialize bodystructure parsing in case we read the whole
message. */
index_mail_init_parser(mail);
if (hdr_size != NULL || body_size != NULL || want_attachment_kw) {
i_stream_seek(data->stream, 0);
if (!data->hdr_size_set || want_attachment_kw) {
- if ((data->access_part & PARSE_HDR) != 0) {
+ if ((data->access_part & (PARSE_HDR | PARSE_BODY)) != 0) {
(void)get_cached_parts(mail);
if (index_mail_parse_headers_internal(mail, NULL) < 0)
return -1;