package main import ( "gitea.inhome.blapointe.com/local-sandbox/contact" "gitea.inhome.blapointe.com/local/args" ) func main() { emailer := contact.NewEmailer() as := args.NewArgSet() as.Append(args.STRING, "to", "email destination", "squeaky2x3@gmail.com") as.Append(args.STRING, "subject", "message subject", "go emailer") as.Append(args.STRING, "body", "message content", "go emailer") as.Append(args.STRING, "pop3", "pop3 server:port", "pop.gmail.com:995") as.Append(args.STRING, "password", "message sender password", emailer.Password) as.Append(args.STRING, "from", "message sender", emailer.From) as.Append(args.STRING, "smtp", "smtp server:port", emailer.SMTP) if err := as.Parse(); err != nil { panic(err) } emailer = &contact.Emailer{ From: as.Get("from").GetString(), SMTP: as.Get("smtp").GetString(), POP3: as.Get("pop3").GetString(), Password: as.Get("password").GetString(), } if err := emailer.Send( as.Get("to").GetString(), as.Get("subject").GetString(), as.Get("body").GetString(), ); err != nil { panic(err) } }