Debian Codegraph @

sender_starttls.go

raw symbols SCIP
1 package mailyakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/
2
3 import (
4 "bytesscip-go gomod github.com/golang/go/src go1.12 bytes/"
5 "netscip-go gomod github.com/golang/go/src go1.12 net/"
6 )
7
8 // senderWithStartTLS connects to the remote SMTP server, upgrades the
9 // connection using STARTTLS if available, and sends the email.
10 type senderWithStartTLSscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS# struct {
11 hostAndPortscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS#hostAndPort. string
12 hostnamescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS#hostname. string
13 bufscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS#buf. *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#
14 }
15
16 func (s *senderWithStartTLSscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS#) Sendscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS#Send().(m sendableMailscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/sendableMail#) error {
17 conn, err := netscip-go gomod github.com/golang/go/src go1.12 net/.Dialscip-go gomod github.com/golang/go/src go1.12 net/Dial().("tcp", s.hostAndPortscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS#hostAndPort.)
18 if err != nil {
19 return err
20 }
21 defer func() { _ = conn.Closescip-go gomod github.com/golang/go/src go1.12 net/Conn#Close().() }()
22
23 return smtpExchangescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/smtpExchange().(m, conn, s.hostnamescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS#hostname., true)
24 }
25
26 func newSenderWithStartTLSscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/newSenderWithStartTLS().(hostAndPort string) *senderWithStartTLSscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS# {
27 hostName, _, err := netscip-go gomod github.com/golang/go/src go1.12 net/.SplitHostPortscip-go gomod github.com/golang/go/src go1.12 net/SplitHostPort().(hostAndPort)
28 if err != nil {
29 // Really this should be an error, but we can't return it from the New()
30 // constructor without breaking compatability. Fortunately by the time
31 // it gets to the dial() the user will get a pretty clear error as this
32 // hostAndPort value is almost certainly invalid.
33 //
34 // This hostname must be split from the port so the correct value is
35 // used when performing the SMTP AUTH as the Go SMTP implementation
36 // refuses to send credentials over non-localhost plaintext connections,
37 // and including the port messes this check up (and is probably the
38 // wrong thing to be sending anyway).
39 hostName = hostAndPort
40 }
41
42 return &senderWithStartTLSscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS#{
43 hostAndPortscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS#hostAndPort.: hostAndPort,
44 hostnamescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS#hostname.: hostName,
45 bufscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/senderWithStartTLS#buf.: &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{},
46 }
47 }