05. Training – Part 2 [6:10]

Description: This video explains the following:

  1. How to send mail.
  2. Including multiple attachments.

Transcript:

In this video we are going to discuss how you send mail with and without attachments. Sending email is as simple as calling the SendMail function, specifying the parameters, meaning setting the To; Cc; Bcc; Subject; Body; and Attachments pass, and simply sending the email in a simple FileMaker script step.

0:30 Let’s open our demo file and take a look at the script steps on how you can send email. Here I’m looking at our demo file, before we begin I’m just going to go ahead and refresh the account list. This is simply gathering all the accounts in MacMail that we can work with, and you call the GetFirstAccount, GetNextAccount, in order to retrieve the account names. Simply note for this demo purpose that whatever name I have in here is the account that I’m actually going to be working with and sending email from. So right now I’m going to be sending email from Melinda, if I wanted to send email from support or from an additional account you would just specify that account.

1:12 So I’ll go back to my Melinda account and let’s navigate to the Mail tab, we’re going to create a new FileMaker record and it’s populated with some test data here. And I’m just going to go ahead and change the subject here to “New Test From Demo”, and in this demo I’ve already prepopulated the To, Cc, Bcc, I now have a Subject, Body, and I’m going leave out attachments the first time we go ahead and send this email. Let’s go ahead and open up Script Debugger, and I will go ahead and select Send Mail, and I’m going to put this back to back with the Data Viewer so you can actually see the script steps involved in sending an email. We are first going to step into the SendMail script, and I’ve disabled a few of the script steps here that are not needed, they’re just more maintenance for the demo checking for browse mode and the Plug-In checker script. And we’re just going to jump right down to a check that we have in our demo file we’re basically just checking right now to make sure that there is a valid recipient in either the To, Cc, or Bcc field. Then we’re going to open an account that we’re going to work with, and this is required because you do have to specify what MacMail account we’re going to work with, and as you recall I’m working with the Melinda account. So we are pulling from whatever value I had specified in the field on the set up tab. You could hard code an account value in here and the design is really up to you as the developer, however you want to design this to meet your client’s needs.

2:51 Next we’re going to simply send the email in a simple script step right here, it’s as simple as this. We’re calling the SendMail function, and we’re going to show a dialog if we get an error, otherwise the email is going to be sent, and we will show a custom dialog that the email has been sent. And that’s it, let’s go ahead and close Debugger.

3:17 And let’s navigate now to MacMail and you can see here I have my email in my sent box that is titled “New Test from Demo”. Let’s go back into FileMaker and let’s go ahead and open up our scripts here and navigate to the SendEmail script so you can see this in a little more detail here, this is the function that allows us to send the email. So here you can see we are calling the SendMail function and then we are specifying our parameters, now you don’t have to reference fields you could actually just hard code values in here, I could hard code joe@abc.com put it in quotes and now every email that I send is going to go to joe@abc.com, now realistically that’s not what you are typically after so you will most likely be doing is referencing a field here. And here we’re referencing the To field, the CC field, our Bcc field, Subject, Body, currently we are sending plain text formatted emails. And then here we’re just giving you options to actually attach multiple attachments, and we’re going to take a look at that in just a moment. So I’m going to go ahead and hit cancel, close our scripts area, and let’s go ahead and generate a new FileMaker record and we’ll call it “Test with attachments”. And go ahead and let’s just attach a couple files here, how about we just put in a couple PDFs. Now as you know traditionally FileMaker SendMail command only allows you send emails with single attachments; our plug-in allows you an unlimited number of attachments that you’d like to send.  Let’s go ahead and add three attachments in there, let’s open up Debugger here, go ahead and hit send mail, and put it back to back with the Data Viewer. And basically we’re just going to step through this here, we’re opening our account to work with and then we’re just going to send this email out with multiple attachments and as you can see here I have the attachment pass specified for the attachments that I’m going to send. And it’s as simple as that, Mail has been sent. Go ahead and close Debugger and sending email really is that simple with the plug-in.

5:50 This is just a small sampling of what the Plug-in can do, for more information please contact us and review our Videos, Documentation and Demo Files. Or send us an email, contact us by phone or browse our forum for answers.  We look forward to hearing from you and thank you for watching.