Skip to content

Commit 4eca415

Browse files
committed
Update SMTP status codes (#1109)
1 parent 5e5771e commit 4eca415

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

crates/jmap/src/api/form.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl FormHandler for Server {
101101
if let Some(domain) = from_email.rsplit_once('@').and_then(|(local, domain)| {
102102
if !local.is_empty()
103103
&& domain.contains('.')
104-
&& psl::suffix(domain.as_bytes()).is_some()
104+
&& psl::domain(domain.as_bytes()).is_some_and(|d| d.suffix().typ().is_some())
105105
{
106106
Some(domain)
107107
} else {

crates/smtp/src/inbound/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl<T: SessionStream> Session<T> {
204204
SpanId = self.data.session_id,
205205
);
206206

207-
self.write(b"421 4.3.0 Too many authentication errors, disconnecting.\r\n")
207+
self.write(b"455 4.3.0 Too many authentication errors, disconnecting.\r\n")
208208
.await?;
209209
Err(())
210210
}

crates/smtp/src/inbound/data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ impl<T: SessionStream> Session<T> {
850850
Limit = self.data.messages_sent
851851
);
852852

853-
self.write(b"451 4.4.5 Maximum number of messages per session exceeded.\r\n")
853+
self.write(b"452 4.4.5 Maximum number of messages per session exceeded.\r\n")
854854
.await?;
855855
Ok(false)
856856
}

crates/smtp/src/inbound/mail.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ impl<T: SessionStream> Session<T> {
513513
);
514514

515515
self.data.mail_from = None;
516-
self.write(b"451 4.4.5 Rate limit exceeded, try again later.\r\n")
516+
self.write(b"452 4.4.5 Rate limit exceeded, try again later.\r\n")
517517
.await
518518
}
519519
}

crates/smtp/src/inbound/rcpt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<T: SessionStream> Session<T> {
5050
SpanId = self.data.session_id,
5151
Limit = self.params.rcpt_max,
5252
);
53-
return self.write(b"451 4.5.3 Too many recipients.\r\n").await;
53+
return self.write(b"455 4.5.3 Too many recipients.\r\n").await;
5454
}
5555

5656
// Verify parameters
@@ -347,7 +347,7 @@ impl<T: SessionStream> Session<T> {
347347
return self
348348
.write(
349349
concat!(
350-
"422 4.2.2 Greylisted, please try ",
350+
"452 4.2.2 Greylisted, please try ",
351351
"again in a few moments.\r\n"
352352
)
353353
.as_bytes(),
@@ -385,7 +385,7 @@ impl<T: SessionStream> Session<T> {
385385

386386
self.data.rcpt_to.pop();
387387
return self
388-
.write(b"451 4.4.5 Rate limit exceeded, try again later.\r\n")
388+
.write(b"452 4.4.5 Rate limit exceeded, try again later.\r\n")
389389
.await;
390390
}
391391

@@ -448,7 +448,7 @@ impl<T: SessionStream> Session<T> {
448448
if !has_too_many_errors {
449449
self.write(response).await
450450
} else {
451-
self.write(b"421 4.3.0 Too many errors, disconnecting.\r\n")
451+
self.write(b"451 4.3.0 Too many errors, disconnecting.\r\n")
452452
.await?;
453453
Err(())
454454
}

crates/smtp/src/inbound/spawn.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl<T: SessionStream> Session<T> {
169169
}
170170
} else if bytes_read > self.data.bytes_left {
171171
self
172-
.write(format!("451 4.7.28 {} Session exceeded transfer quota.\r\n", self.hostname).as_bytes())
172+
.write(format!("452 4.7.28 {} Session exceeded transfer quota.\r\n", self.hostname).as_bytes())
173173
.await
174174
.ok();
175175

@@ -181,7 +181,7 @@ impl<T: SessionStream> Session<T> {
181181
break;
182182
} else {
183183
self
184-
.write(format!("453 4.3.2 {} Session open for too long.\r\n", self.hostname).as_bytes())
184+
.write(format!("421 4.3.2 {} Session open for too long.\r\n", self.hostname).as_bytes())
185185
.await
186186
.ok();
187187

@@ -246,7 +246,7 @@ impl<T: SessionStream> Session<T> {
246246
Reason = "Server shutting down",
247247
CausedBy = trc::location!()
248248
);
249-
self.write(b"421 4.3.0 Server shutting down.\r\n").await.ok();
249+
self.write(format!("421 4.3.0 {} Server shutting down.\r\n", self.hostname).as_bytes()).await.ok();
250250
break;
251251
}
252252
};

0 commit comments

Comments
 (0)