HowTo: Using the SendEmail Method From Interop in Smart Devices API

Official Content
This documentation is valid for:

The Interop External Object that can be found below the SD folder provides several methods to interact with the device where the app is running.

InteropEOMethods

The SendEmail method provides a way to send an email from your application. When this method is executed, it opens the native email application of the device with a new email ready to be sent. You can call the method with three parameters:

To: Recipient of the email. Based on the Email domain.
Subject: Subject of the email.
Message: Content of the email you want to send.

 

This article will show an example of how this feature is used.

First, create a new Panel object (called SDPanel):

InteropSDPanel

Add a variable based on the Email domain, as well as one variable based on VarChar(200) to the SDPanel for the message and another for the subject (in the sendEmail method, the size of the varchar parameters passed to it doesn't matter; even though it asks for a varchar(200), it could receive a message of any size, for example, bigger than 200). The variable based on Email is going to be the recipient of the email.

sendEmailvari

Add the variables to the Section General (right-click/Insert Variable) and add a new Action to the Layout (right-click/Insert Action).

InteropAddVarActionToLayout

Make sure the variables have the property Readonly = False.

Go to the event of the action by double-clicking on the button and add the following code:

Event 'Email'
    Interop.SendEmail(&to,&subject,&theMsg)
EndEvent

Done! The entry panel will accept an email address and a msg. When the Send button is tapped, an email with the parameters in the To and Content field is going to be invoked.

sendemailiphone1

sendemailiphone2