mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 03:07:45 +08:00
added the example for gsmtp
This commit is contained in:
parent
fb8aac38dd
commit
57244a9553
24
.example/net/gsmtp/gsmtp_sendMail.go
Normal file
24
.example/net/gsmtp/gsmtp_sendMail.go
Normal file
@ -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! <br><br> This is body"))
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user