mirror of
				https://github.com/knadh/listmonk.git
				synced 2025-11-04 05:07:15 +08:00 
			
		
		
		
	feat: Add from_email to postback struct for sending tx postbacks (#1623)
				
					
				
			This commit is contained in:
		
							parent
							
								
									e869f7b0a9
								
							
						
					
					
						commit
						be62c50b3c
					
				
					 2 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -17,6 +17,7 @@ import (
 | 
			
		|||
//easyjson:json
 | 
			
		||||
type postback struct {
 | 
			
		||||
	Subject     string       `json:"subject"`
 | 
			
		||||
	FromEmail   string       `json:"from_email"`
 | 
			
		||||
	ContentType string       `json:"content_type"`
 | 
			
		||||
	Body        string       `json:"body"`
 | 
			
		||||
	Recipients  []recipient  `json:"recipients"`
 | 
			
		||||
| 
						 | 
				
			
			@ -96,6 +97,7 @@ func (p *Postback) Name() string {
 | 
			
		|||
func (p *Postback) Push(m models.Message) error {
 | 
			
		||||
	pb := postback{
 | 
			
		||||
		Subject:     m.Subject,
 | 
			
		||||
		FromEmail:   m.From,
 | 
			
		||||
		ContentType: m.ContentType,
 | 
			
		||||
		Body:        string(m.Body),
 | 
			
		||||
		Recipients: []recipient{{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,8 @@ func easyjsonDf11841fDecodeGithubComKnadhListmonkInternalMessengerPostback(in *j
 | 
			
		|||
		switch key {
 | 
			
		||||
		case "subject":
 | 
			
		||||
			out.Subject = string(in.String())
 | 
			
		||||
		case "from_email":
 | 
			
		||||
			out.FromEmail = string(in.String())
 | 
			
		||||
		case "content_type":
 | 
			
		||||
			out.ContentType = string(in.String())
 | 
			
		||||
		case "body":
 | 
			
		||||
| 
						 | 
				
			
			@ -119,6 +121,11 @@ func easyjsonDf11841fEncodeGithubComKnadhListmonkInternalMessengerPostback(out *
 | 
			
		|||
		out.RawString(prefix[1:])
 | 
			
		||||
		out.String(string(in.Subject))
 | 
			
		||||
	}
 | 
			
		||||
	{
 | 
			
		||||
		const prefix string = ",\"from_email\":"
 | 
			
		||||
		out.RawString(prefix)
 | 
			
		||||
		out.String(string(in.FromEmail))
 | 
			
		||||
	}
 | 
			
		||||
	{
 | 
			
		||||
		const prefix string = ",\"content_type\":"
 | 
			
		||||
		out.RawString(prefix)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue