Files
gf/.example/other/test.go

51 lines
1006 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"fmt"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/text/gstr"
)
func main() {
type Sender struct {
Name string `json:"name"`
Email string `json:"email"`
}
type To struct {
Name string `json:"name"`
Email string `json:"email"`
}
type SendReq struct {
Sender *Sender `json:"sender"`
//Name string `json:"name"`
HtmlContent string `json:"htmlContent"`
Subject string `json:"subject"`
To []*To `json:"to"`
}
//url := "emailCampaigns"
sendreq := SendReq{
Sender: &Sender{
Name: "123",
Email: "globalclienthelp@gmail.com",
},
To: []*To{{
Name: "456",
//Email: order.Email,
Email: "jinmao88@hotmail.com",
}},
}
subject := ""
htmlcontent := ""
subject = " Your order" + gstr.Split("11111", "-")[1] + " Shipment is on its way."
htmlcontent = "test"
sendreq.Subject = subject
sendreq.HtmlContent = htmlcontent
j, err := gjson.DecodeToJson(sendreq)
fmt.Println(err)
fmt.Println(j)
}