MCPcopy
hub / github.com/jordan-wright/email / build

Method build

pool.go:207–233  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

205}
206
207func (p *Pool) build() (*client, error) {
208 cl, err := smtp.Dial(p.addr)
209 if err != nil {
210 return nil, err
211 }
212
213 // Is there a custom hostname for doing a HELLO with the SMTP server?
214 if p.helloHostname != "" {
215 cl.Hello(p.helloHostname)
216 }
217
218 c := &client{cl, 0}
219
220 if _, err := startTLS(c, p.tlsConfig); err != nil {
221 c.Close()
222 return nil, err
223 }
224
225 if p.auth != nil {
226 if _, err := addAuth(c, p.auth); err != nil {
227 c.Close()
228 return nil, err
229 }
230 }
231
232 return c, nil
233}
234
235func (p *Pool) maybeReplace(err error, c *client) {
236 if err == nil {

Callers 1

makeOneMethod · 0.95

Calls 3

CloseMethod · 0.95
startTLSFunction · 0.85
addAuthFunction · 0.85

Tested by

no test coverage detected