37 lines
		
	
	
		
			973 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			37 lines
		
	
	
		
			973 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package authservice
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								import (
							 | 
						|||
| 
								 | 
							
									"fmt"
							 | 
						|||
| 
								 | 
							
									"github.com/mailjet/mailjet-apiv3-go"
							 | 
						|||
| 
								 | 
							
									"log"
							 | 
						|||
| 
								 | 
							
									"testing"
							 | 
						|||
| 
								 | 
							
								)
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								func TestName(t *testing.T) {
							 | 
						|||
| 
								 | 
							
									mailjetClient := mailjet.NewMailjetClient("00d2889da90d5d90767bf04dc1bdc6fa", "f68cd84cd88b7e2aabce79c878a77e97")
							 | 
						|||
| 
								 | 
							
									messagesInfo := []mailjet.InfoMessagesV31{
							 | 
						|||
| 
								 | 
							
										{
							 | 
						|||
| 
								 | 
							
											From: &mailjet.RecipientV31{
							 | 
						|||
| 
								 | 
							
												Email: "a745455408@163.com",
							 | 
						|||
| 
								 | 
							
												Name:  "Tokex",
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
											To: &mailjet.RecipientsV31{
							 | 
						|||
| 
								 | 
							
												mailjet.RecipientV31{
							 | 
						|||
| 
								 | 
							
													Email: "2811588041@qq.com",
							 | 
						|||
| 
								 | 
							
													Name:  "YCZ",
							 | 
						|||
| 
								 | 
							
												},
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
											Subject:  "Register/Login",
							 | 
						|||
| 
								 | 
							
											TextPart: "欢迎注册登录我们的服务,您的验证码为:123456",
							 | 
						|||
| 
								 | 
							
											// HTMLPart: "<h3>欢迎注册登录我们的服务,您的验证码为:1234567</h3><br />May the delivery force be with you!",
							 | 
						|||
| 
								 | 
							
											// CustomID: "AppGettingStartedTest",
							 | 
						|||
| 
								 | 
							
										},
							 | 
						|||
| 
								 | 
							
									}
							 | 
						|||
| 
								 | 
							
									messages := mailjet.MessagesV31{Info: messagesInfo}
							 | 
						|||
| 
								 | 
							
									res, err := mailjetClient.SendMailV31(&messages)
							 | 
						|||
| 
								 | 
							
									if err != nil {
							 | 
						|||
| 
								 | 
							
										log.Println(err)
							 | 
						|||
| 
								 | 
							
									}
							 | 
						|||
| 
								 | 
							
									fmt.Printf("Data: %+v\n", res)
							 | 
						|||
| 
								 | 
							
								}
							 |