email

package
v1.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendComplexMessage

func SendComplexMessage(domain, apiKey string) (string, error)

func SendScheduledMessage

func SendScheduledMessage(domain, apiKey string) (string, error)

Types

type Mailgun

type Mailgun struct {
	Domain string // ie: mail.xxx.com
	APIKey string
}

func (*Mailgun) SendBatchEmail

func (mgObj *Mailgun) SendBatchEmail(from, subject, text, template string, to map[string]interface{})

当大于1000条的时候,自动分成若干个1000条的发出去。

func (*Mailgun) SendBatchMessageLessThan1k

func (mgObj *Mailgun) SendBatchMessageLessThan1k(from, subject, text, template string, to map[string]interface{})

https://documentation.mailgun.com/en/latest/user_manual.html#batch-sending The maximum number of recipients allowed for Batch Sending is 1,000.

to的形式:{
  "user1@example.com" : {"var1": "ABC123456789", "var2": "adfsa"},
  "user2@example.com" : {"var1": "ZXY987654321", "var2": "34123"}
}

func (*Mailgun) SendSimpleMessage

func (mgObj *Mailgun) SendSimpleMessage(from, subject, text, template, to string)

func (*Mailgun) SendSimpleMessageWithRecipientAndVariables added in v1.0.13

func (mgObj *Mailgun) SendSimpleMessageWithRecipientAndVariables(from, subject, text, template string, to map[string]interface{}) error

func (*Mailgun) SendSimpleMessageWithTemplateVariables added in v1.0.13

func (mgObj *Mailgun) SendSimpleMessageWithTemplateVariables(from, subject, text, template, to string, templateVar map[string]interface{}) error

如mailgun template里的variable是 {{var}} 则用m.AddTemplateVariable(var, value)来设置所有模板,所有的收件人的邮件内容都是一样的 如mailgun template里的variable是 {%recipient.var%} 则用m.AddRecipientAndVariables(r, {"var":value})来设置,每个收件人的邮件内容都是独特的

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL