You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Under some circumstances a the header in the final email contains an empty line. We are building an email client, and some messages are rejected because of this: deltachat/deltachat-core-rust#2118
This test reproduces the problem:
#[test]
fn test_no_empty_directly() {
let to_tuples = vec![
("Nnnn", "[email protected]"),
("😀 ttttttt", "[email protected]"),
("dididididididi", "[email protected]"),
("Ttttttt", "[email protected]"),
("Mmmmm", "[email protected]"),
("Zzzzzz", "[email protected]"),
("Xyz", "[email protected]"),
("", "[email protected]"),
("qqqqqq", "[email protected]"),
("bbbb", "[email protected]"),
("", "[email protected]"),
("rqrqrqrqr", "[email protected]"),
("tttttttt", "[email protected]"),
("", "[email protected]"),
];
let mut to = Vec::new();
for (name, addr) in to_tuples {
if name.is_empty() {
to.push(Address::new_mailbox(addr.to_string()));
} else {
to.push(Address::new_mailbox_with_name(
name.to_string(),
addr.to_string(),
));
}
}
let mut message = email::MimeMessage::new_blank_message();
message.headers.insert(
(
"Content-Type".to_string(),
"text/plain; charset=utf-8; format=flowed; delsp=no".to_string(),
)
.into(),
);
message
.headers
.insert(Header::new_with_value("To".into(), to).unwrap());
message.body = "Hi".to_string();
println!("======= HEADERS BEFORE CALL TO AS_STRING: =======");
for h in message.headers.iter() {
println!("{}", h);
}
let msg = message.as_string(); // <-- seems like here the empty line is introduced
let header_end = msg.find("Hi").unwrap();
let headers = msg[0..header_end].trim();
println!(
"======= HEADERS AFTER CALL TO AS_STRING: =======\n{}\n",
headers
);
assert!(!headers.lines().any(|l| l.trim().is_empty())); // <-- panics
}
Under some circumstances a the header in the final email contains an empty line. We are building an email client, and some messages are rejected because of this: deltachat/deltachat-core-rust#2118
This test reproduces the problem:
Output:
The text was updated successfully, but these errors were encountered: