Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/323.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
将EML转换为MSG-Java_Java_Aspose_Msg_Eml - Fatal编程技术网

将EML转换为MSG-Java

将EML转换为MSG-Java,java,aspose,msg,eml,Java,Aspose,Msg,Eml,我想从EML文件中读取附件。我更喜欢将EML文件转换为MSG文件,这样我就可以重复使用编写的代码,这可能吗?如果没有,是否有从EML文件读取附件的方法 如果没有,是否有从EML文件读取附件的方法 支持读取EML文件(MIME类型消息/rfc822)。参见示例 然后提取附件。另请参见。您可以使用Aspose.Email API实现EML到MSG的转换和从EML提取附件 从EML中提取附件 //Initialize and Load an existing EML file MailMessage

我想从EML文件中读取附件。我更喜欢将EML文件转换为MSG文件,这样我就可以重复使用编写的代码,这可能吗?如果没有,是否有从EML文件读取附件的方法

如果没有,是否有从EML文件读取附件的方法

支持读取EML文件(MIME类型
消息/rfc822
)。参见示例


然后提取附件。另请参见。

您可以使用Aspose.Email API实现EML到MSG的转换和从EML提取附件

从EML中提取附件

//Initialize and Load an existing EML file
MailMessage msg = MailMessage.load(dataDir + "EmailWithAttachment.eml", new EmlLoadOptions());

//Initialize AttachmentCollection object with MailMessage Attachments
AttachmentCollection attachments = msg.getAttachments();

//Iterate over the AttachmentCollection
for (int index = 0; index < attachments.size(); index++) {
    //Initialize Attachment object and Get the indexed Attachment reference
    Attachment attachment = (Attachment) attachments.get_Item(index);
    //Display Attachment Name
    System.out.println(attachment.getName());
    //Save Attachment to disk
    attachment.save(dataDir + "attachment_" + attachment.getName());
}
有关这方面的更多信息,您可以进一步访问

我与Aspose合作,担任开发人员宣传员

// Initialize and Load an existing EML file by specifying the MessageFormat
MailMessage eml = MailMessage.load(dataDir + "test.eml");
//Save the Email message to disk in Unicode format
eml.save(dataDir + "LoadingEMLSavingToMSG_out.msg", SaveOptions.getDefaultMsgUnicode());