|
|
|
@ -204,7 +204,7 @@ pub struct SmtpExtensionSupport {
|
|
|
|
|
//envelope exchange.
|
|
|
|
|
#[serde(default = "crate::conf::true_val")]
|
|
|
|
|
prdr: bool,
|
|
|
|
|
#[serde(default = "crate::conf::false_val")]
|
|
|
|
|
#[serde(default = "crate::conf::true_val")]
|
|
|
|
|
binarymime: bool,
|
|
|
|
|
//Resources:
|
|
|
|
|
//- http://www.postfix.org/SMTPUTF8_README.html
|
|
|
|
@ -227,7 +227,7 @@ impl Default for SmtpExtensionSupport {
|
|
|
|
|
chunking: true,
|
|
|
|
|
prdr: true,
|
|
|
|
|
_8bitmime: true,
|
|
|
|
|
binarymime: false,
|
|
|
|
|
binarymime: true,
|
|
|
|
|
smtputf8: true,
|
|
|
|
|
auth: true,
|
|
|
|
|
dsn_notify: Some("FAILURE".into()),
|
|
|
|
@ -641,7 +641,9 @@ impl SmtpConnection {
|
|
|
|
|
if self.server_conf.extensions.prdr {
|
|
|
|
|
current_command.push(b" PRDR");
|
|
|
|
|
}
|
|
|
|
|
if self.server_conf.extensions._8bitmime {
|
|
|
|
|
if self.server_conf.extensions.binarymime {
|
|
|
|
|
current_command.push(b" BODY=BINARYMIME");
|
|
|
|
|
} else if self.server_conf.extensions._8bitmime {
|
|
|
|
|
current_command.push(b" BODY=8BITMIME");
|
|
|
|
|
}
|
|
|
|
|
self.send_command(¤t_command).await?;
|
|
|
|
@ -688,6 +690,15 @@ impl SmtpConnection {
|
|
|
|
|
//permitted on either side of the colon following FROM in the MAIL command or TO in the
|
|
|
|
|
//RCPT command. The syntax is exactly as given above.
|
|
|
|
|
|
|
|
|
|
if self.server_conf.extensions.binarymime {
|
|
|
|
|
let mail_length = format!("{}", mail.as_bytes().len());
|
|
|
|
|
self.send_command(&[b"BDAT", mail_length.as_bytes(), b"LAST"])
|
|
|
|
|
.await?;
|
|
|
|
|
self.stream
|
|
|
|
|
.write_all(mail.as_bytes())
|
|
|
|
|
.await
|
|
|
|
|
.chain_err_kind(crate::error::ErrorKind::Network)?;
|
|
|
|
|
} else {
|
|
|
|
|
//The third step in the procedure is the DATA command
|
|
|
|
|
//(or some alternative specified in a service extension).
|
|
|
|
|
//DATA <CRLF>
|
|
|
|
@ -752,6 +763,7 @@ impl SmtpConnection {
|
|
|
|
|
.write_all(b".\r\n")
|
|
|
|
|
.await
|
|
|
|
|
.chain_err_kind(crate::error::ErrorKind::Network)?;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//The end of mail data indicator also confirms the mail transaction and tells the SMTP
|
|
|
|
|
//server to now process the stored recipients and mail data. If accepted, the SMTP
|
|
|
|
|