EmailOpen(jsn As String)

 

Opens an email client window for composing and sending an Email.

 

Use this command when you wish to overwrite default mail server settings and sender email data.

 

This EmailOpen command takes 1 paramter to prefill the window with default data before it is displayed to the user.

The parameter is a JSON String which can contain from 1 to 11 set values.

The names of these values must be used as listed below.

  

Parameters:

 

Name

Type

Description

jsn

String

A JSON string created with the JsonCreate function, containing values added with the JsonSetValue command.

Optional values:

Name

Description

 

subject

Subject (title) of the email

 

content

Default body text of the email

 

recipientemail

Email address of the recipient

 

recipientname

Full name of the recipient

 

senderemail

Email address of sender

 

sendername

Full name of sender

 

logtext

Text to be added to the logging section
at the settings panel of the email window

 

server

IP address or DNS name of mailserver (like "mail.example.com")

 

username

sender email account user name

 

password

sender email account user password

 

filebox

The name of the filebox control (like "imFB_inf_Files ") from where selected files are copied to the email window. These files are sent as attachments with the email.
Right-Click on the filename to remove an attachment.

Optional file attachments:

Name

Description

 

file1

file2

É

fileN

Parameter name is "file" + counter, like: file1, file2, file3, etc

 

One can use 1-N files to be attached to an email

 

The value for each file is the nativepath string to it, as it is obtained when using the GetFilePath function (See example below)

 

Available in:

 

WindowMain

WindowLink

NO

YES

 

 Used in:

 

XojoScript Name

GUID

Send Seminar Invoice by Email

024F872B-9E87-499F-9D2D-208C4C32E4CF

 

Hint: You can find references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%EmailOpen%'

 

Example XojoScript:

 If IsLinkMode = 1 then

// Running Script only AFTER LinkMode was set.

 

// Run this code only if we are doing a seminar registration

If GetActiveLinking = "link_adr_evt" Then

 

// Get ID's

Dim adr_id As Integer = LinkList_GetID("adr")

Dim evt_id As Integer = LinkList_GetID("evt")

 

Dim salutation As String = GetText("imTF_adr_Salutation",adr_id)

 

// Define filenames for boilerplate text, for bodytext of email to participant

Dim bodyTextFile As String = "MailTextE.txt"

 

// Retrieve the language specific boilerplate text

Dim boilerplate As String = GetFileText("imFB_evt_Files",bodyTextFile,evt_id)  // email bodytext

Dim logtext As String = "Using body text 'MailTextE.txt'"

salutation = salutation + "," + EOL + EOL + boilerplate

 

// Set Email Text

Dim title As String  = "Confirmation and Invoice Nr. " _

+ GetText("imTF_lnk_p01_InvoiceNo")  // subject

 

Dim body As String = salutation

 

// Set Email recipient

Dim email As String = GetText("imTF_adr_EmailAddress",adr_id)  // recipient email

Dim name As String = GetText("imTF_adr_Linkbox", adr_id)      // recipient name

 

// Set Filebox containing attachment files

Dim filebox As String = "imFB_lnk_p04_Files" // filebox name with attachments files

 

Dim handle As Integer = JsonCreate

If handle >= 0 Then

 

// The key names must be exactly as used below

JsonSetValue(handle,"subject",title)

JsonSetValue(handle,"content",body)

JsonSetValue(handle,"recipientemail",email)

JsonSetValue(handle,"recipientname",name)

JsonSetValue(handle,"filebox",filebox)

JsonSetValue(handle,"logtext",logtext)

 

// Set additional files from seminar, to be attached to email

Dim file1 As String = GetFilePath("imFB_evt_Files","AGBs.pdf",evt_id)

 

// Add more files if necessary by following the naming convention: file1, file2, file3, etc

JsonSetValue(handle,"file1",file1)

 

Dim js As String = JsonToString(handle)

EmailOpen(js)

 

End If // hJSON >= 0

End If  // GetActiveLinking = "link_adr_evt" Then

End If  // If IsLinkMode = 1