switch to quoted-printable, which is already used by mailparse

This commit is contained in:
dignifiedquire
2019-12-05 13:23:31 +01:00
committed by holger krekel
parent c2e8cc9bd6
commit 3b8e37de58
3 changed files with 7 additions and 14 deletions

View File

@@ -1,6 +1,5 @@
use chrono::TimeZone;
use lettre_email::{mime, Address, Header, MimeMultipartType, PartBuilder};
use rfc2047::rfc2047_encode;
use crate::chat::{self, Chat};
use crate::config::Config;
@@ -383,7 +382,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
let mut unprotected_headers: Vec<Header> = Vec::new();
let from = Address::new_mailbox_with_name(
rfc2047_encode(&self.from_displayname).into_owned(),
quoted_printable::encode_to_str(&self.from_displayname),
self.from_addr.clone(),
);
@@ -395,7 +394,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
to.push(Address::new_mailbox(addr.clone()));
} else {
to.push(Address::new_mailbox_with_name(
rfc2047_encode(name).into_owned(),
quoted_printable::encode_to_str(name),
addr.clone(),
));
}
@@ -451,7 +450,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
let e2ee_guranteed = self.is_e2ee_guranteed();
let mut encrypt_helper = EncryptHelper::new(self.context)?;
let subject = rfc2047_encode(&subject_str).into_owned();
let subject = quoted_printable::encode_to_str(&subject_str);
let mut message = match self.loaded {
Loaded::Message => {
@@ -611,7 +610,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
if chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup {
protected_headers.push(Header::new("Chat-Group-ID".into(), chat.grpid.clone()));
let encoded = rfc2047_encode(&chat.name).into_owned();
let encoded = quoted_printable::encode_to_str(&chat.name);
protected_headers.push(Header::new("Chat-Group-Name".into(), encoded));
match command {
@@ -994,7 +993,7 @@ fn build_body_file(
// XXX do we need to encode filenames?
format!(
"attachment; filename*=\"{}\"",
rfc2047_encode(&filename_to_send)
quoted_printable::encode_to_str(&filename_to_send)
)
};