MCPcopy Create free account
hub / github.com/coder/coder / sendTestEmail

Function sendTestEmail

scaletest/smtpmock/server_test.go:189–203  ·  view source on GitHub ↗
(smtpAddr, to, subject, body string)

Source from the content-addressed store, hash-verified

187}
188
189func sendTestEmail(smtpAddr, to, subject, body string) error {
190 from := "noreply@coder.com"
191 now := time.Now().Format(time.RFC1123Z)
192
193 msg := strings.Builder{}
194 _, _ = msg.WriteString(fmt.Sprintf("From: %s\r\n", from))
195 _, _ = msg.WriteString(fmt.Sprintf("To: %s\r\n", to))
196 _, _ = msg.WriteString(fmt.Sprintf("Subject: %s\r\n", subject))
197 _, _ = msg.WriteString(fmt.Sprintf("Date: %s\r\n", now))
198 _, _ = msg.WriteString("Content-Type: text/html; charset=UTF-8\r\n")
199 _, _ = msg.WriteString("\r\n")
200 _, _ = msg.WriteString(body)
201
202 return smtp.SendMail(smtpAddr, nil, from, []string{to}, []byte(msg.String()))
203}

Callers 4

TestServer_FilterByEmailFunction · 0.85
TestServer_PurgeFunction · 0.85

Calls 3

WriteStringMethod · 0.80
FormatMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected