From a312021a4e32cf8a8514ed858cd255cd089a64ce Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 8 Sep 2022 16:37:29 -0400 Subject: [PATCH] email test skeleton (#50, #51) --- cmd/zrok-email/main.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cmd/zrok-email/main.go diff --git a/cmd/zrok-email/main.go b/cmd/zrok-email/main.go new file mode 100644 index 00000000..f9ec1b2f --- /dev/null +++ b/cmd/zrok-email/main.go @@ -0,0 +1,33 @@ +package main + +import ( + "github.com/michaelquigley/pfxlog" + "github.com/sirupsen/logrus" + "net/smtp" + "os" +) + +func init() { + pfxlog.GlobalInit(logrus.InfoLevel, pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti-test-kitchen/")) +} + +func main() { + from := "ziggy@zrok.io" + to := []string{"michael@quigley.com"} + host := "smtp.email.us-ashburn-1.oci.oraclecloud.com" + port := "587" + + msg := "Subject: Ziggy\r\n" + + "\r\n" + + "Hello from Ziggy!\r\n" + body := []byte(msg) + + auth := smtp.PlainAuth("", os.Args[1], os.Args[2], host) + + err := smtp.SendMail(host+":"+port, auth, from, to, body) + if err != nil { + panic(err) + } + + logrus.Infof("message sent") +}