add hire/resume pages, contact form, security middleware, and admin improvements
This commit is contained in:
18
internal/mailer/mailer.go
Normal file
18
internal/mailer/mailer.go
Normal file
@@ -0,0 +1,18 @@
|
||||
// Package mailer sends email via the local SMTP relay (OpenSMTPD on localhost:25).
|
||||
package mailer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/smtp"
|
||||
)
|
||||
|
||||
const from = "noreply@ridgwaysystems.org"
|
||||
|
||||
// Send delivers a plain-text email through the local MTA.
|
||||
func Send(to, subject, body string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"From: %s\r\nTo: %s\r\nSubject: %s\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n%s",
|
||||
from, to, subject, body,
|
||||
)
|
||||
return smtp.SendMail("localhost:25", nil, from, []string{to}, []byte(msg))
|
||||
}
|
||||
Reference in New Issue
Block a user