Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Email 如何使用MailJet api附加excel文档_Email_Mailjet - Fatal编程技术网

Email 如何使用MailJet api附加excel文档

Email 如何使用MailJet api附加excel文档,email,mailjet,Email,Mailjet,您好,我已尝试使用mailjets api发送excel文档。 我首先使用mailjets库将excel文件编码为base64。 然后,我使用mailjets库将文件添加为附件,并设置mime类型application/vnd.ms-excel。 这里有一个例子 request = new MailjetRequest(Emailv31.resource) .property(Emailv31.MESSAGES, new JSONArray()

您好,我已尝试使用mailjets api发送excel文档。 我首先使用mailjets库将excel文件编码为base64。 然后,我使用mailjets库将文件添加为附件,并设置mime类型application/vnd.ms-excel。 这里有一个例子

 request = new MailjetRequest(Emailv31.resource)
            .property(Emailv31.MESSAGES, new JSONArray()
                .put(new JSONObject()
                    .put(Emailv31.Message.FROM, new JSONObject()
                        .put("Email", "pilot@mailjet.com")
                        .put("Name", "Mailjet Pilot"))
                    .put(Emailv31.Message.TO, new JSONArray()
                        .put(new JSONObject()
                            .put("Email", "passenger1@mailjet.com")
                            .put("Name", "passenger 1")))
                    .put(Emailv31.Message.SUBJECT, "Your email flight plan!")
                    .put(Emailv31.Message.TEXTPART, "Dear passenger 1, welcome to Mailjet! May the delivery force be with you!")
                    .put(Emailv31.Message.HTMLPART, "<h3>Dear passenger 1, welcome to <a href=\"https://www.mailjet.com/\">Mailjet</a>!</h3><br />May the delivery force be with you!")
                    .put(Emailv31.Message.ATTACHMENTS, new JSONArray()
                        .put(new JSONObject()
                            .put("ContentType", "application/vnd.ms-excel")
                            .put("Filename", "test.txt")
                            .put("Base64Content", "excelFileBase64")))));
      response = client.post(request);

request=newmailjetrequest(Emailv31.resource)
.property(Emailv31.MESSAGES,新的JSONArray()
.put(新的JSONObject()
.put(Emailv31.Message.FROM,新的JSONObject())
.put(“电子邮件”)pilot@mailjet.com")
.put(“姓名”、“邮机飞行员”))
.put(Emailv31.Message.TO,新的JSONArray()
.put(新的JSONObject()
.put(“电子邮件”)passenger1@mailjet.com")
.put(“姓名”、“乘客1”))
.put(Emailv31.Message.SUBJECT,“您的电子邮件飞行计划!”)
.put(Emailv31.Message.TEXTPART,“亲爱的乘客1,欢迎来到Mailjet!祝投递人员与您同在!”)
.put(Emailv31.Message.HTMLPART,“亲爱的乘客1,欢迎光临!
祝送货员与您同在!” .put(Emailv31.Message.ATTACHMENTS,新的JSONArray() .put(新的JSONObject() .put(“ContentType”、“application/vnd.ms excel”) .put(“文件名”、“test.txt”) .put(“Base64Content”、“excelFileBase64”()())); 响应=client.post(请求);
但是,我总是以base64编码的字符串形式接收文件