Forum

Share

Please consider registering
guest

Log In RegisterMembers
Or log in with

Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
How to get message body?
October 10, 2010
11:32 am
lusiano
Guest

I hope no one have asked this before, try to search at the forum but no one asked this spesific

 

I read that its to large to pass the message body as parameter, but

- How to get the message body if the message is short?

I dont know how to use the massageid to get the messagebody, the file in .thunderbird is too big and in one file and i dont know how to extract data from it using messageid.

 

Please help how to get the message body?

 

I need the body to run script, the massage body maybe only have 5 word in it with 2 fixed word at the front

 

Thank You.

Share
October 10, 2010
1:30 pm
Admin
Forum Posts: 323
Member Since:
July 12, 2008
Offline

I wish there was an easy way to get the message body, but I have not found one. The problem is that the methods required to get the message body all work using async processing, but the search terms and filter actions are really best suited to sync processing.

I am guessing that what you are looking for is the message body in a filter action. My standard Run custom action does not support that. The next easiest thing to try would be writing a Javascript filter action using FiltaQuilla's javascript action. The basic steps would be that you need to stream the message, get the stream, and extract the body from that. Both normal message streaming and normal message MIME processing (which extracts the body) are async operations. Do you have any familiarity with Mozilla platform programming? If so, you might be able to get around this by 1) streaming to as nsISyncStreamListener (which attempts to bypass the async nature of steam message), then scanning the message yourself to locate the body as the stuff after \r\n\r\n. This would be around 10 lines of javascript. But nsISyncStreamListener is a risky function, I tried to use it to get the message in a search term, and that caused crashes. I think that a filter action would be more forgiving, but I have not tested is. If that does not work, you would need to write an extension, and that could probably do what you want.

Sorry that I don't have an easy answer for you. I realize that this is a desired feature.

Share
October 20, 2010
1:49 am
Robert
Guest

Hi

I have a similar question, but it would be enough for me to have a filter action that saved the current message as an .eml file in a given folder (like the save attachment action). Is that possible?

 

At the moment the only way I can see to do this is to set Thunderbird to forward emails as attachments. Then set a rule to forward the desired email to myself, and then have another rule that finds the forwarded copy and saves out the .eml attachment…

 

It would be much simpler if there was an action to save the message as .eml!

 

Any ideas gratefully received…

 

Many thanks – Robert

Share
October 20, 2010
2:58 pm
Admin
Forum Posts: 323
Member Since:
July 12, 2008
Offline

Saving the message as a file is not difficult, as there is an existing backend method in the message service that supports this. The issue will be deciding where to store the file, and what to call it. I suppose in a filter, I would allow the user to select the storage folder, then save the file using probably the escaped messageID as the name.

Is that enough for your application, or do you need some method to trigger an external application that the new message exists? (I suppose an external application could just watch the storage folder for new files).

 

rkent

Share
October 21, 2010
4:52 am
Robert
Guest

Hi

Many thanks.

With the method I am using at the moment (using forward as attachment) then the name of the file is the subject line of the message + .eml and that's fine for me (I can use the subject line then in the watching application)

Yes in a filter just the location for the file to be saved to… the same as for the "Save Attachment" action. Maybe an option to use the subject line or the unique message id or a given name would be useful for other people…

Yes, I am using a watcher application that monitors the folder… so I have some filter rules that use "Save Attachment" which then saves the attachments from some messages to the watched folder. But I have some cases where there is just an html body of the message instead of say an attachment – I can pull this out of the .eml file in the watcher app.

 

best regards – Robert

Share
October 24, 2010
10:19 pm
Robert
Guest

Curiously now my plan A is not working – for some reason (a bug?) the save attachments filter is not working with an attached eml file that originates from a forwarded message! Any ideas?

 

Many thanks – Robert

Share
October 25, 2010
6:02 am
Admin
Forum Posts: 323
Member Since:
July 12, 2008
Offline

I don't have any ideas. But the save attachments filter function uses an older backend call that is also used I believe by the core code (unlike detach, which is a function that was added to core by me in 3.1 to support FiiltaQuilla's detach filter.)

So does a manual SaveAs also fail for these same messages?

Share
October 26, 2010
12:54 am
Robert
Guest

Yes (manually as well) … I will try detach. My guess would be that .eml attachments are seen as different (as they may be forwarded messages) and are thus being ignored. A message with an .eml and another attchment, saves the other attachment not the eml…

 

Thanks – Robert

 

PS just tried Detach manually with the same result… a message with two eml attachments and one other non-eml attachment saves only the non-eml attachment (Detach seems to leave the attachment in the message, but doesn't repeat if it's done it once already?)

Share
December 29, 2010
2:28 pm
Skip
Guest

rkent said:

I wish there was an easy way to get the message body, but I have not found one. The problem is that the methods required to get the message body all work using async processing, but the search terms and filter actions are really best suited to sync processing.

I am guessing that what you are looking for is the message body in a filter action. My standard Run custom action does not support that. The next easiest thing to try would be writing a Javascript filter action using FiltaQuilla's javascript action. The basic steps would be that you need to stream the message, get the stream, and extract the body from that. Both normal message streaming and normal message MIME processing (which extracts the body) are async operations. Do you have any familiarity with Mozilla platform programming? If so, you might be able to get around this by 1) streaming to as nsISyncStreamListener (which attempts to bypass the async nature of steam message), then scanning the message yourself to locate the body as the stuff after \r\n\r\n. This would be around 10 lines of javascript. But nsISyncStreamListener is a risky function, I tried to use it to get the message in a search term, and that caused crashes. I think that a filter action would be more forgiving, but I have not tested is. If that does not work, you would need to write an extension, and that could probably do what you want.

Sorry that I don't have an easy answer for you. I realize that this is a desired feature.


 How much would you charge to have your ext, save incoming mails to a folder as a action?

Share
December 29, 2010
2:38 pm
Admin
Forum Posts: 323
Member Since:
July 12, 2008
Offline

By save to a folder, do you mean saving a message an email file (.eml) to a standard operating system folder?

Share
December 30, 2010
3:08 am
Skip
Guest

Yes, basically what I do manaully is save the email as a eml to a system folder.

Share
December 30, 2010
10:08 am
Admin
Forum Posts: 323
Member Since:
July 12, 2008
Offline

I spent a few minutes looking at this request and the code that might be required. It is not trivial, but I believe it could be done with a custom filter action under FiltaQuilla. As a rough estimate, I would say it would take about $300 to do this.

Here is how I like to proceed in these cases, if you are interested. If the rough estimate of $300 is in the general range of what you are able to pay, then I would put additiional effort into this to be able to give you a firm estimate (which generally means doing about half of the work, and convincing myself it is doable at all).  Then I would give you a firm price for the finished work. You would pay the firm price (through PayPal for example) and I would finish and deliver an updated version of FiltaQuilla that contains this option. If there are issues with the result from your perspective, I would (within reason) fix the issues at no additional charge.

If you would like to proceed in this manner, please inform me. I would need to know just a little more about who you are – like your organizational affiliation and where you live – just so that I know I am dealing with a real person. You can always email to me directly at rkent@mesquilla.com

rkent

Share
Forum Timezone: UTC -8

Most Users Ever Online: 18

Currently Online:
11 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

bobkatz: 8

BigMike: 8

t2m: 7

zabolyx: 7

taa: 6

onlyme: 6

Member Stats:

Guest Posters: 130

Members: 565

Moderators: 1

Admins: 1

Forum Stats:

Groups: 1

Forums: 7

Topics: 231

Posts: 802

Moderators: rkent (323)

Administrators: rkent (323)