all repos — flounder @ 3ec267fae76b5f2ad46f32d84fa27ee67dc2673b

A small site builder for the Gemini protocol

mail.go (view raw)

 1package main
 2
 3import (
 4	"log"
 5	"net/smtp"
 6)
 7
 8func SendEmail(email string, subject string, body string) {
 9	auth := smtp.PlainAuth("", c.SMTPUsername, c.SMTPPassword, "smtp.migadu.com")
10	msg := "From: " + c.SMTPUsername + "\n" +
11		"To: " + email + "\n" +
12		"Cc: " + c.SMTPUsername + "\n" +
13		"Subject:" + subject + "\n" +
14		body
15	err := smtp.SendMail(c.SMTPServer, auth, c.SMTPUsername, []string{email}, []byte(msg))
16	if err != nil {
17		// doesnt need to block anything i think
18		log.Println(err)
19	}
20}