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

Method StartDelivery

internal/msgpipeline/msgpipeline.go:121–142  ·  view source on GitHub ↗

StartDelivery starts new message delivery, runs connection and sender checks, sender modifiers and selects source block from config to use for handling. Returned module.Delivery implements PartialDelivery. If underlying target doesn't support it, msgpipeline will copy the returned error for all rec

(ctx context.Context, msgMeta *module.MsgMetadata, mailFrom string)

Source from the content-addressed store, hash-verified

119// support it, msgpipeline will copy the returned error for all recipients handled
120// by target.
121func (d *MsgPipeline) StartDelivery(ctx context.Context, msgMeta *module.MsgMetadata, mailFrom string) (module.Delivery, error) {
122 dd := msgpipelineDelivery{
123 d: d,
124 rcptModifiersState: make(map[*rcptBlock]module.ModifierState),
125 deliveries: make(map[module.DeliveryTarget]*delivery),
126 msgMeta: msgMeta,
127 log: target.DeliveryLogger(d.Log, msgMeta),
128 }
129 dd.checkRunner = newCheckRunner(msgMeta, dd.log, d.Resolver)
130 dd.checkRunner.doDMARC = d.doDMARC
131
132 if msgMeta.OriginalRcpts == nil {
133 msgMeta.OriginalRcpts = map[string]string{}
134 }
135
136 if err := dd.start(ctx, msgMeta, mailFrom); err != nil {
137 dd.close()
138 return nil, err
139 }
140
141 return &dd, nil
142}
143
144func (dd *msgpipelineDelivery) start(ctx context.Context, msgMeta *module.MsgMetadata, mailFrom string) error {
145 var err error

Calls 3

startMethod · 0.95
closeMethod · 0.95
newCheckRunnerFunction · 0.85