Check-in [667b874fdb]
Logged in as anonymous
Overview
Comment:mess with header/body formatting
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 667b874fdb55a2b1834d0bb9cc95ee9a68b9ea17787076179ea9264a47a8d79b
User & Date: arcade on 2024-05-22 13:39:26.263
Other Links: manifest | tags
Context
2024-05-22
15:11
fix parsing a little... check-in: 03fe0265ac user: arcade tags: trunk
13:39
mess with header/body formatting check-in: 667b874fdb user: arcade tags: trunk
13:31
use LMTP for socket server check-in: 51adce1e7e user: arcade tags: trunk
Changes
87
88
89
90
91
92
93
94

95
96

97
98
99

100
101
102

103
104
105
106
107
108
109
87
88
89
90
91
92
93

94
95

96
97
98

99
100
101

102
103
104
105
106
107
108
109







-
+

-
+


-
+


-
+







						rcpt.insert(core.default);
						core.debug("No recipient or envelope address.").await.unwrap();
					};

					// prepating message header
					let mut reply: Vec<Cow<str>> = vec![];
					if let Some(subject) = mail.subject() {
						reply.push(format!("<b>Subject:</b> {}", subject).into());
						reply.push(format!("**Subject:** `{}`", subject).into());
					} else if let Some(thread) = mail.thread_name() {
						reply.push(format!("<b>Thread:</b> {}", thread).into());
						reply.push(format!("**Thread:** `{}`", thread).into());
					}
					if let Some(from) = mail.from() {
						reply.push(format!("<b>From:</b> {:?}", from).into());
						reply.push(format!("**From:** `{:?}`", from).into());
					}
					if let Some(sender) = mail.sender() {
						reply.push(format!("<b>Sender:</b> {:?}", sender).into());
						reply.push(format!("**Sender:** `{:?}`", sender).into());
					}
					reply.push("".into());
					let header_size = reply.join("\n").len() + 1;

					let html_parts = mail.html_body_count();
					let text_parts = mail.text_body_count();
					let attachments = mail.attachment_count();
128
129
130
131
132
133
134

135

136
137
138
139
140
141
142
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144







+

+







					if body == "" && text_parts > 0 {
						let text = mail.body_text(0).unwrap();
						if text.len() < 4096 - header_size {
							body = text;
							text_num = 1;
						}
					};
					reply.push("```".into());
					reply.push(body);
					reply.push("```".into());

					// and let's coillect all other attachment parts
					let mut files_to_send = vec![];
					/*
					 * let's just skip html parts for now, they just duplicate text?
					while html_num < html_parts {
						files_to_send.push(mail.html_part(html_num).unwrap());