Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: Save attachments to Parser.WorkingFolder Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
jtsr
Newbie
Newbie


Joined: 20 February 2019
Location: Australia
Online Status: Offline
Posts: 8
Posted: 16 March 2020 at 10:25pm | IP Logged Quote jtsr

The GetHtmlAndSaveRelatedFiles() method appears to create a folder within the Parser.WorkingFolder path, which is excellent as it ensures all email files are isolated.

Is it possible to save all attachments in a MailMessage to the same directory?
Back to Top View jtsr's Profile Search for other posts by jtsr
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 17 March 2020 at 12:59am | IP Logged Quote Alex

Hi,

Sure:

msg.Attachments.SaveAll(msg.Parser.WorkingFolder);

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
jtsr
Newbie
Newbie


Joined: 20 February 2019
Location: Australia
Online Status: Offline
Posts: 8
Posted: 17 March 2020 at 3:41pm | IP Logged Quote jtsr

Thanks Alex, but it's doing what I would have expected. I'll try to explain what I'm trying to do.

First, I set msg.Parser.WorkingFolder to a directory, eg. c:\jtsr\temp\email

Then I call msg.GetHtmlAndSaveRelatedFiles(msg.Parser.WorkingFolder, VirtualMappingType.Static, MessageFolderBehavior.CreateAndDelete)

This method call creates an email specific folder, c:\jtsr\temp\email\A292F1..., and saves the content of the email (signature icons, inline images) in that folder.

However, the msg.Attachments.SaveAll(msg.Parser.WorkingFolder) call places the email attachments in c:\jtsr\temp\email, not in c:\jtsr\temp\email\A292F1...

I'd like all content and attachments for a single email to be contained in their own folder. I realise I can create a folder using Directory.Create() and manage it all manually, however I was hoping the library would manage this for me :)
Back to Top View jtsr's Profile Search for other posts by jtsr
 
jtsr
Newbie
Newbie


Joined: 20 February 2019
Location: Australia
Online Status: Offline
Posts: 8
Posted: 17 March 2020 at 4:02pm | IP Logged Quote jtsr

Ah ha! Is this what I'm after?

MessageParserConfig.GetMessageFolder()
Back to Top View jtsr's Profile Search for other posts by jtsr
 
jtsr
Newbie
Newbie


Joined: 20 February 2019
Location: Australia
Online Status: Offline
Posts: 8
Posted: 17 March 2020 at 4:38pm | IP Logged Quote jtsr

It's now working beautifully with MessageParserConfig.GetMessageFolder()
Back to Top View jtsr's Profile Search for other posts by jtsr
 
jtsr
Newbie
Newbie


Joined: 20 February 2019
Location: Australia
Online Status: Offline
Posts: 8
Posted: 17 March 2020 at 5:41pm | IP Logged Quote jtsr

While I'm at it, is there a way of saving only actual attachments rather than all images that appear in the EML file?

If I use the Attachments.SaveAll method, it returns all the signature icons as well. Is there a way to only return attachments that were attached to the email?
Back to Top View jtsr's Profile Search for other posts by jtsr
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 18 March 2020 at 12:56am | IP Logged Quote Alex

By setting ignoreInlineAttachments=true when calling SaveAll(folderName, ignoreInlineAttachments) method.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
jtsr
Newbie
Newbie


Joined: 20 February 2019
Location: Australia
Online Status: Offline
Posts: 8
Posted: 18 March 2020 at 2:30pm | IP Logged Quote jtsr

Alex wrote:
By setting ignoreInlineAttachments=true when calling SaveAll(folderName, ignoreInlineAttachments) method.

Regards,
Alex


I tried this, however it is returning all attachments as inline for some reason. I’ve tried it in multiple eml files and all attachments are being treated the same.
Back to Top View jtsr's Profile Search for other posts by jtsr
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 19 March 2020 at 1:21am | IP Logged Quote Alex

You can submit a sample of EML in question to our helpdesk at https://s.afterlogic.com/helpdesk

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide