DGEE Posted August 20, 2007 Posted August 20, 2007 Greetings... a quick question from a new developer. Is there a way to attach incoming email to a specific contacts record? Thanks, -Dgee
Fenton Posted August 20, 2007 Posted August 20, 2007 The phrase "incoming email" is a little vague. Because there are plug-ins which can check your mail and get directly with only FileMaker, i.e., they do not use your email client (Apple Mail? Entourage?). But this really requires a dedicated email address for this mail. Otherwise you have the opposite problem, all your email coming into FileMaker, personal, spam, etc.. It is also quite possible to have AppleScript get mail from your email client and push it to FileMaker. This can actually run automatically, using a Rule, which runs after the mail is checked, and can run an AppleScript (using a special opening format). Or it can be run from a FileMaker script (which is what I do for "archiving" mail). Now we have to define what you mean by "attach". Email comes in, in Apple Mail anyway, as separate files. Just like any other file, they can be "attached" to a FileMaker file in various ways: 1. Inserted embedded into a container field. 2. Inserted as reference into a container field. 3. Capture the file path only, and open with AppleScript. 4. Capture the file path only, and open with OpenURL. Alternatively, and I think this is route I would pursue, AppleScript can get the actual contents of the email and put that, as text, into a FileMaker record. That way you can read and search it without having the email client involved. It also allows you to delete it from the email client later. Lots of choices.
DGEE Posted August 20, 2007 Author Posted August 20, 2007 Fenton, thanks for your reply. I do like your last suggestion best, as it appears to be closest to our goal. We are tossing Goldmine CRM out the door, but need an option to archive all of our customers email directly to their file - this appears to do that without worrying about all of the spam. Now as a newbie, we'll need to figure out how to do that.... Thanks.
Fenton Posted August 20, 2007 Posted August 20, 2007 Here is the most basic of AppleScripts to import all the messages from 1 specified mail folder ("Saved Mail" in this case) of the Apple Mail application into a FileMaker file. It only gets From, Timestamp, and Body. In real life you'd need quite a bit more than this. The problem here is synchronization. You do not want to import the same message twice. There's a few approaches to this, and I'm not even sure which would be best. One thing you have going for you is that an email is pretty well identified, From & Timestamp. There is also a unique ID given by Mail to every email. If you bring that in, then you'd know that message was already imported. The problem with synchronization is not so much whether it can be done, as it certainly can. The question is more what is the fastest way to do it, considering the large number of FileMaker records and Mail messages likely to be tested. It seems to me that running the AppleScript as a Rule in the Mail problem would be the best approach, as then it only has to deal with the mail that just came in. It can then move each email it processes (copying to FileMaker) to either a "Clients" folder in the Mail app, or to an individual folder for the client (though how it would identify that would be tricky, since the folders aren't the same name as the email address; and some people have multiple email addresses). Unfortunately, the attached file is as far as I've gotten with Apple Mail. EmailfromMailfolder.zip
DGEE Posted August 21, 2007 Author Posted August 21, 2007 Thanks Fenton. However with more thought and research I am not sure the build process vs. what we are needing to do is worth it. We get a large amount of new customers each day through 'sample' product downloads that come to us via email, with just an e-address and their name. Ideally, opening that email should create a new customer file and then attach itself to that file... and each subsequent e-communication both in and out should do the same. In all of our new business, the email address is the primary field of contact. I guess we are looking to push FM to be more of a all-in-one CRM package than a great db, and it looks like that may be more of a development task then we are able.
Fenton Posted August 25, 2007 Posted August 25, 2007 I've been messing about with this. I've got an AppleScript which will import emails (with attachments) into FileMaker, either automatically, or run from the Scripts menu. But it's not quite ready for posting as a Sample file. You might want to take a look at this shareware app, which does pretty much the same thing, as far as I can tell. It is an AppleScript Studio application, so it has dialogs, configuration, etc.. It looks well done, and is only $15. http://www.automatedworkflows.com/software/mail_to_filemaker.html I will still continue on mine, as it would be a little more extendable. I'm thinking it could match client email addresses to mailboxes, etc.; though that's going to take some doing.
DGEE Posted September 13, 2007 Author Posted September 13, 2007 Thanks Fenton... I took a look and it does seem to offer the goods, but keep us posted on your's. We have continued our research and playing around with the 30 day trial and the newly released Business Productivity Kit and I think it will take a little work, but I like what I see. I am not a programmer, but with a little tenacity, this forum group and maybe some lynda.com I think we can get it going. One other question for you, using the Productivity kit as a starting point seems like a no-brainer... however the module windows all have : "Business Productivity Solutions - Contacts" or whatever the module is as the name. I have tried every trick in the book I know of to change this name to our business name, "FECNetwork - Contacts" for example, but no way can I. The solution guide says you can add to the productivity kit and use it as your own or create from scratch using the examples in the kit so changing the module/window names would be kind of nice. Any thoughts on that? Thanks, -Derek
DGEE Posted September 13, 2007 Author Posted September 13, 2007 Hi Fenton, just a quick note to say thanks for your help. Another forum member has answered the above, I do appreciate your time and assistance. -Derek
Fenton Posted September 14, 2007 Posted September 14, 2007 (edited) Yeah, I saw that, in another forum. I have run into a fairly serious shortcoming when trying to integrate Mail with FileMaker. It cannot be called a bug exactly, but, IMHO, it is a lack in the AppleScript support. BTW, the program I mentioned has it also. Which is that some emails are formatted in such a way (encoding) so that you cannot get the body of the email using the normal "contents" command. You just get question marks, "???". You can get the "source", but it is not very nice. If it is "quoted-printable", a common email format, then it has weird characters for line endings. OK, that's bearable, I suppose. But if also has HTML, it is as is, HTML. All of this is especially a problem with emails with forwarded sections from other people. There can be multiple sections, mixed up with quoted-printable text. A real mess. I've been making progress in transforming it all into decent looking text. Unfortunately I haven't yet been able to reassemble it as 1 file/text. If anyone knows a better way to do this, please tell me :-| I know I could do it with UI scripting and copy/paste, but I'd rather not. It is a real lack of functionality in Apple Mail AppleScript support; a dirty little secret of the Mac platform is that modern Apple apps can have spotty AppleScript support. Supposedly Leopard Mail is going to have native HTML support, so maybe we'll see some progress there. Safari for example can get any page's content as text. Edited September 14, 2007 by Guest
Recommended Posts
This topic is 6280 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now