如何使用这些包“ google.golang.org/appengine/mail”在Go中上传附件

以下是我尝试发送的带有附件的代码。


    msg := &mail.Message{

                    Sender: "kasireddy002@gmail.com",

                    To:     []string{addr},

          Attachments : []Attachment{

                           Name :"file name",

                            Data :[]byte,

                        ContentID :"fileid",

                      },


                    Subject: "Welcome to Simplyst Health: Verify your account",

    if err := mail.Send(context, msg); err != nil {

                    log.Errorf(ctx, "Alas, my user, the email failed to sendeth: err)

                }

当我尝试保存代码时,将引发错误。


错误:


cannot use []Attachment literal (type []Attachment) as type []"google.golang.org/appengine/mail".Attachment in field value



蝴蝶刀刀
浏览 221回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP