From 57244a9553a5a965432f9c4de5048e3a88462cf5 Mon Sep 17 00:00:00 2001 From: LetMyPplGo <54865472+LetMyPplGo@users.noreply.github.com> Date: Fri, 6 Sep 2019 01:18:41 +0300 Subject: [PATCH] added the example for gsmtp --- .example/net/gsmtp/gsmtp_sendMail.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .example/net/gsmtp/gsmtp_sendMail.go diff --git a/.example/net/gsmtp/gsmtp_sendMail.go b/.example/net/gsmtp/gsmtp_sendMail.go new file mode 100644 index 000000000..8496c43e9 --- /dev/null +++ b/.example/net/gsmtp/gsmtp_sendMail.go @@ -0,0 +1,24 @@ +// Copyright 2017 gf Author(https://github.com/gogf/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. +package main + +import ( + "fmt" + + "github.com/gogf/gf/net/gsmtp" +) + +func main() { + + // create the SMTP connection + smtpConnection := gsmtp.New("smtp.exmail.qq.com", "smtpUser@smtp.exmail.qq.com", "smtpPassword") + // or you can specify the port explicitly + // smtpConnection := smtp.New("smtp.exmail.qq.com:25", "smtpUser@smtp.exmail.qq.com", "smtpPassword") + + // send the Email + fmt.Println(smtpConnection.SendMail("sender@local.host", "recipient1@domain.com;recipientN@anotherDomain.cn", "This is subject", "Hi!

This is body")) + +}