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
I can return a custom *SMTPError object, but handleMail and handleRcpt methods won't set the c.fromReceived or add the recipient into the c.recipients.
--- a/conn.go+++ b/conn.go@@ -419,6 +419,9 @@ func (c *Conn) handleMail(arg string) {
if err := c.Session().Mail(from, opts); err != nil {
if smtpErr, ok := err.(*SMTPError); ok {
c.WriteResponse(smtpErr.Code, smtpErr.EnhancedCode, smtpErr.Message)
+ if smtpErr.Code == 250 {+ c.fromReceived = true+ }
return
}
c.WriteResponse(451, EnhancedCode{4, 0, 0}, err.Error())
@@ -507,6 +510,9 @@ func (c *Conn) handleRcpt(arg string) {
if err := c.Session().Rcpt(recipient); err != nil {
if smtpErr, ok := err.(*SMTPError); ok {
c.WriteResponse(smtpErr.Code, smtpErr.EnhancedCode, smtpErr.Message)
+ if smtpErr.Code == 250 {+ c.recipients = append(c.recipients, recipient)+ }
return
}
c.WriteResponse(451, EnhancedCode{4, 0, 0}, err.Error())
The text was updated successfully, but these errors were encountered:
kayrus
changed the title
Add support to handle a custom response for "Rcpt" method
Add support to handle a custom response for "Mail" and "Rcpt" methods
Jun 2, 2022
kayrus
changed the title
Add support to handle a custom response for "Mail" and "Rcpt" methods
Handle a custom response for "Mail" and "Rcpt" session methods
Jun 2, 2022
kayrus
changed the title
Handle a custom response for "Mail" and "Rcpt" session methods
Server: handle a custom response for "Mail" and "Rcpt" session methods
Jun 3, 2022
I can return a custom
*SMTPError
object, buthandleMail
andhandleRcpt
methods won't set thec.fromReceived
or add the recipient into thec.recipients
.See below:
go-smtp/conn.go
Lines 400 to 410 in 608f3c2
go-smtp/conn.go
Lines 488 to 497 in 608f3c2
I suggest the following fix:
The text was updated successfully, but these errors were encountered: