One of the top feature requests we’ve heard from customers using Access 2013 web apps hosted inside Office 365 is the need to be able to send emails from their apps. We listened and today we’re proud to announce that a new feature called “Send Email” is available to all of our customers using Office 365 with Access Services. Now you can send emails from your Access 2013 web apps to other members of your organization! Look for this feature in your web apps soon and try it out.
In order to see and use this new feature, you need to update Access: you must be using Access 2013 that has a minimum build number of 15.0.4649.1000. Once your Office 365 site has the new Send Email feature work turned on, and you’re using the minimum Access 2013 build, you’ll see the new SendEmail macro action in the Action Catalog when you’re designing data macros.
How does the Send Email feature work?
You can use the new SendEmail action when you’re working with data macros—both named data macros and data macros attached to table events (On Insert, On Update, and On Delete). When you’re working with named data macros, which you can run from control events on views displayed in your web browser, you can, for example, send an email about a specific record you’re viewing. In this scenario, you could create a command button or a custom Action Bar button on a view that uses the RunDataMacro action in the On Click event to run your saved named data macro that includes the new SendEmail action.
When you’re working with data macros attached to table events, you can send emails when new records are added, existing records are edited, or records are deleted. In this scenario, it makes it easy to alert relevant users within your organization when new records are created, modified, or deleted. To get started, you just double-click SendEmail in the Action Catalog to add it to the macro logic defined for that table event and fill in the required parameters.
Let’s take a closer look at how this works in an example of sending an email from a table event, in this case an On Insert event of an Orders table in an Access 2013 web app. As you can see in the following screenshot, the new SendEmail macro action is available within the Action Catalog.
Let’s discuss what the other data macro actions defined in this On Insert table event are doing before we discuss the new SendEmail action.
First, the existing defined macro actions look up the email address and first name of the employee for the new order entered into the app and assigns that information to local variables that are used later in the data macro.
Next, the data macro looks up the company name for the order and assigns that to a local variable as well.
The next three SetLocalVar actions build up various parts of the body of the email message, using HTML tags to add further customization to the message body. For example, if you want to include a line break in the message, you can use a <br> tag in the message.
The last action in the macro logic for this example is the new SendEmail macro action. To add the new action to the macro design window, just double-click SendEmail in the Action Catalog. The SendEmail macro action takes five arguments: To, Cc, Bcc, Subject, and Body.
|To||Yes||The recipients of the message whose names you want to put on the To line in the message. Separate the recipient names that you specify in this argument (and in the Cc and Bcc arguments) with a semicolon (;).|
|Cc||No||The message recipients whose names you want to put on the Cc (carbon copy) line in the message.|
|Bcc||No||The message recipients whose names you want to put on the Bcc (blind carbon copy) line in the message.|
|Subject||Yes||The subject of the message. This text appears on the Subject line in the message.|
|Body||Yes||The text that you want to include in the main body of the mail message.|
For the To, Cc, and Bcc arguments, you can currently send emails only to people within your Office 365 organization. The email addresses used must be within the same company site or belong to guests of the site. For example, if your Office 365 company name is Contoso, the email addresses used with the SendEmail action must correspond to users of the Contoso site. Typically, they would be formatted as email@example.com.
Each of the arguments in the SendEmail action accepts the use of expressions. If you want to use an expression for one of the arguments, first type an equal sign (=), followed by the expression you want to use. When you type the equal sign, Access displays the Expression Builder button on the right side of the argument text box. You can click this button and use the Expression Builder dialog to help you build the expression, or combination of expressions, you want to use.
Using expressions, you can create custom emails that display relevant data from the app. In the following screenshot, you can see an example of the Expression Builder dialog displaying the expression we used for the Body argument of the SendEmail action for this table event. In this example, the Concat function is used in the Body argument of the SendEmail action to concatenate the three local variables previously defined in the SetLocalVar actions. The three local variables are combining HTML tags, custom message text, and record data within the app and the Body argument expression is combining all three of them together for the full email message. You can be very creative with the email messages you send from your apps using these expression techniques and your own imagination.
Here’s an example of what a completed email message looks like when you enter a new order into the app with the defined macro logic shown earlier.
That’s how using the new SendEmail data macro action on table events works. For sending emails from named data macros, you define the data macro logic the same way: just by double-clicking SendEmail from the Action Catalog and providing the needed parameters. And you also have opportunities to customize your messages in these scenarios as well.
Being able to send emails from your apps opens up more possibilities for using your custom Access 2013 web apps built on top of Office 365. We hope you enjoy this new Send Email feature within Access 2013 web apps hosted inside Office 365. Give it a try and let us know what you think!
—Jeff Conrad is a Senior Content Developer on the Office Creative Content Development team.