hub.eb?material_id=321&track_id=408

Email Resources


Use an Email Resource to send emails using a configured Email Account.

You can create a new Email Resource by selecting File > New >  Email Resource. This will open the Email Resource editor where the Email Account to use can be configured along with other email-specific properties including:

  • From address senders email address.
  • To address recipients email address.
  • Subject description of the email's contents.
  • Message the main content. You can specify that your email message will contain HTML by enabling the HTML Message option.

Like all Resources, Resource Fields can be configured, mapped to a Form's Fields and && substituted in the Email Resource's properties.

An Email Resource can be added to a Form by dragging it from the Entities tree into the Form's Resource View. Once added, the Verj.io JavaScript API's resources interface can be used to send an email, for example:

resources.myEmailResource.sendmail()

If Success of this Email is critical has been selected, then sendmail() will throw an error if an email fails to send.

You can attach files to an email by passing an array of file paths to the sendmail() function.

Steps


1

Create a new Email Resource and name it myEmailResource.

Configure it as shown in the screenshot below and select Success of this Email is critical.

2

Create a Form and add myEmailResource to it.

Import the Fields from myEmailResource, using the Import fields from external resource wizard in the Form's Fields View.

Drag all the imported Fields to the Page's Outline or WYSIWYG View to create Field Controls for them.

3

Add a Button Control to the bottom of the Page and set its text to Send Email.

Add an On Click event script with the following code:

try{
  resources.myEmailResource.sendmail();
}
catch(e){
  log("Failed to send email to " + fields.toAddress.value);
}
4

Run the Form. Enter your email address and a message to yourself and then click the Send Email button.

You should receive an email shortly (although you may have to check your junk mail as the Email Resource is using a test Email Account).

Current Module

Part of tracks

Related