06. Push and Pull Email [6:55]

Description: This video explains the following:

  • Adding attachments to emails
  • Review scripting for SendMail push
  • Sending email with short and long method
  • Review scripting for sending mail with long method
  • Review scripting for pulling email


0:00 OK, in this video we going to learn how to push and pull email to and from FileMaker and Outlook.

0:11 So first let’s talk about pushing email.

0:15 I have here a sample email and on the left I have FileMaker and on the right I have Outlook.

0:21 And let’s just go ahead and send the email.

0:25 You’ll see here in my outbox the email that was here – is now here. So it’s the “To:” going to that person, the subject, and the body. I can also do an attachment. So I happen to have here an attachment in my recycle bin for some—like a spreadsheet. So let’s go ahead and add an attachment to that.

0:52 Dragged it to my desktop. There is my attachment. And now, this time, I’ll send an email, and I’ve got an attachment.

1:00 And you can see here the attachment of the spreadsheet was included. Now, the advantage of using a plug-in versus using FileMaker is you can send multiple attachments.

1:10 So a great way to see multiple attachments is to look at the advanced demo – we demonstrate that.

1:17 OK. Let’s take a look at the script that produces this send mail push.

1:22 Mail- SendMail right here. And, essentially, it’s – we do our normal housekeeping and verify that we have authenticated. In this case, we’re using the simple email method, simple push.

1:37 And the command or the function is PCEM_SendMail and the parameters are the “To”, the “CC”, the “BCC”, “Subject”, “Body”, “Attachments”, and whether we want to use HTML, formatted, or plain text.

1:53 And then we populate that here – in the actual calculation. That’s how that works. So that’s we call the simple method of sending mail.

2:03 Now, the more advanced method you can find in the other demo file. Let’s go ahead and open that real quick.

2:11 And browse for it. Look at the advanced demo on this one. Let’s authenticate.

2:27 Alright and click “Mail”. “Create a New Record” here. And in this one you can send as HTML, rich text, or plain text. So if I want to send as HTML, I can do that. And let’s go ahead and use the long method for this.

2:47 And now this email will actually format itself as an HTML email.

2:53 Let’s go take a look at the script that does that. Let’s go to the button that uses the long method— just to see what script step that is. OK. It is the “Send Mail Long Method”.

3:05 Going to go into the script work space here. Put in the keyword “long”. And let’s take a look.

3:14 OK. So for this one, obviously, this is the advanced demo, so it is a little bit more robust in what it does and what it needs to do.

3:20 But first we identify and open the root folder. This allows you to have multiple profiles and/or multiple folders – or multiple accounts, if you will. Like, for instance, if you’re using an Exchange account, you can have multiple Exchange accounts open. So the root folder is what dictates what account you’re working with. And the folder itself – the “Open Folder command” is what module, like Contacts, Calendar, and, in this case, Mail.

3:44 And then here we’re creating a new record. And we’re opening that record.

3:53 And we’re setting the various fields. You can see this is a lot longer method, but the advantage of the long method is that you can do multiple attachments.

4:02 So here we can see there is a portion that handles multiples attachments through a loop. And that way you can send multiple attachments. You can do HTML email in either of them, but this long method is mainly for a more robust method. You would also use the long method if you’re doing email that is related to Calendar and appointments.

4:24 All of this can be examined both here in the demo, as well as in the documentation.

4:30 So that is just a brief overview of the long method for sending. So I think we have covered sending mail, at least an overview of it. So let me go ahead and close this advanced demo and go back to the basic demo.

4:40 And then, likewise, we can push email – and we have the results there. But we can also pull email.

4:47 Now, in my inbox I have a few emails here that happen to be Twitter feeds, but it could be anything— and let’s go ahead and pull those.

4:56 And so it pulled in those 12 emails. And you can see it brings in the ID, where it was sent and received, the time stamps, who it was from or who it is to, the subject, the body, and the header. So it can even pull the header.

5:11 And then if we wanted to go, let’s say, to the third or fourth email here— this one from Joel. If I want to view that, it will bring up that exact email.

5:19 So, recommend you look at the other videos to kind of see how a lot of this works. But, essentially, it is the same concept for whether you’re dealing with mail or calendaring. Let’s go ahead and look at the script work space for pulling email.

5:36 And I believe this is “Mail Extract. So first we delete all the records if there were any. Then we do our normal housekeeping for authenticate and so forth. We open the mail folder.

5:51 Because we need to know what mail folder to pull from – in this case it would be the inbox and that’s what this is here – “/inbox” – it indicates that, so I could pull from any of these folders.

6:01 The Drafts or any folder that you create you can pull from – so there is a lot of power there with that pull.

6:08 Then we get the count just to verify how many we’re going to be pulling, because we’re going to be looping through and we want the loop to end after it reaches the total count that it sees.

6:19 Grab the first record—pull all the fields individually. Create a new record and loop through that until it reaches the total record that we have in the inbox or in the folder that we designate.

6:34 So I hope that explains how Mail works with the Outlook Manipulator.

6:40 To learn more, contact us at sales@Productivecomputing.com or visit our website: www.productivecomputing.com. Thank you for watching.