feat(search): integrate mailbox directory tree into search interface

This commit is contained in:
rustmailer
2026-03-15 03:36:02 +08:00
parent 2b10d201ee
commit af0f47c0e3
27 changed files with 374 additions and 2293 deletions
+12 -1
View File
@@ -16,6 +16,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
use std::io::Write;
use mail_parser::{parsers::MessageStream, MessageParser, MimeHeaders};
use crate::{
@@ -108,7 +110,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
#[tokio::test]
async fn test44() {
let path = r"C:\Users\polly\Downloads\test333.eml";
let path = r"C:\Users\polly\Downloads\3462966311412541.eml";
let input = std::fs::read(path).unwrap();
let message = MessageParser::default().parse(&input).unwrap();
for attachment in message.attachments() {
@@ -120,6 +122,15 @@ async fn test44() {
let disposition = attachment.content_disposition();
let body_start = attachment.raw_body_offset() as usize;
let body_end = attachment.raw_end_offset() as usize;
if body_start < input.len() && body_end <= input.len() && body_start <= body_end {
//let raw_data = &input[body_start..body_end];
let mut file = std::fs::File::create(&filename).unwrap();
file.write_all(attachment.contents()).unwrap();
}
let file_type = format!(
"{}/{}",
content_type.c_type.as_ref(),