MCPcopy Create free account
hub / github.com/foxcpp/maddy / Mail

Method Mail

internal/endpoint/smtp/session.go:277–301  ·  view source on GitHub ↗
(from string, opts *smtp.MailOptions)

Source from the content-addressed store, hash-verified

275}
276
277func (s *Session) Mail(from string, opts *smtp.MailOptions) error {
278 if s.endp.authAlwaysRequired && s.connState.AuthUser == "" {
279 return smtp.ErrAuthRequired
280 }
281
282 s.msgLock.Lock()
283 defer s.msgLock.Unlock()
284
285 if !s.endp.deferServerReject {
286 // Will initialize s.msgCtx.
287 msgID, err := s.startDelivery(s.sessionCtx, from, *opts)
288 if err != nil {
289 if !errors.Is(err, context.DeadlineExceeded) {
290 s.log.Error("MAIL FROM error", err, "msg_id", msgID)
291 }
292 return s.endp.wrapErr(msgID, !opts.UTF8, "MAIL", err)
293 }
294 }
295
296 // Keep the MAIL FROM argument for deferred startDelivery.
297 s.mailFrom = from
298 s.opts = *opts
299
300 return nil
301}
302
303func (s *Session) fetchRDNSName(ctx context.Context) {
304 defer trace.StartRegion(ctx, "rDNS fetch").End()

Calls 3

startDeliveryMethod · 0.95
wrapErrMethod · 0.80
ErrorMethod · 0.45