-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
smtp_builder.go
28 lines (23 loc) · 972 Bytes
/
smtp_builder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package truemail
// SMTP validation builder entities interface
type builder interface {
newSmtpRequest(int, string, string, *Configuration) *SmtpRequest
newSmtpClient(*SmtpRequestConfiguration) client
}
// SMTP entities builder structure
type smtpBuilder struct{}
// interface implementation
// SMTP request builder. Returns pointer to configured new SMTP request structure
func (builder *smtpBuilder) newSmtpRequest(attempts int, targetEmail, targetHostAddress string, configuration *Configuration) *SmtpRequest {
return &SmtpRequest{
Attempts: attempts,
Email: targetEmail,
Host: targetHostAddress,
Configuration: newSmtpRequestConfiguration(configuration, targetEmail, targetHostAddress),
Response: new(SmtpResponse),
}
}
// SMTP client builder. Returns pointer to configured new SMTP client
func (builder *smtpBuilder) newSmtpClient(configuration *SmtpRequestConfiguration) client {
return newSmtpClient(configuration)
}