BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr
Fix ApiMailBatchSend
lotk24b2b6171902
diff --git a/core/internal/controller/batch_mail/batch_mail_v1_api_mail_batch_send.go b/core/internal/controller/batch_mail/batch_mail_v1_api_mail_batch_send.goindex 718ccbf3..09a3c05e 100644--- a/core/internal/controller/batch_mail/batch_mail_v1_api_mail_batch_send.go+++ b/core/internal/controller/batch_mail/batch_mail_v1_api_mail_batch_send.go@@ -42,20 +42,21 @@ func (c *ControllerV1) ApiMailBatchSend(ctx context.Context, req *v1.ApiMailBatc// 4. check recipientif len(req.Recipients) == 0 {- // res.Code = 1003- // res.SetError(gerror.New(public.LangCtx(ctx, "Recipients cannot be empty")))- // return res, nil+ res.Code = 1003+ res.SetError(gerror.New(public.LangCtx(ctx, "Recipients cannot be empty")))+ return res, nil- // 取当前联系人表中所有收件人来发件 g.DB().Model("bm_contacts")- contacts, err := g.DB().Model("bm_contacts").Where("active = 1").All()- if err != nil {- res.Code = 1005- res.SetError(gerror.New(public.LangCtx(ctx, "Failed to get contacts: {}", err.Error())))- return res, nil- }- for _, contact := range contacts {- req.Recipients = append(req.Recipients, contact["email"].String())- }+ //contacts, err := g.DB().Model("bm_contacts").Where("group_id",1).All()+ //if err != nil {+ // res.Code = 1005+ // res.SetError(gerror.New(public.LangCtx(ctx, "Failed to get contacts: {}", err.Error())))+ // return res, nil+ //}+ //recipientaa := []string{}+ //for _, contact := range contacts {+ // recipientaa = append(recipientaa, contact["email"].String())+ //}+ //req.Recipients = recipientaa}validRecipients := make([]string, 0, len(req.Recipients))