3.6.5.4. Send Selected Document via Email Using a Customizable Button
NOTE: Please note that this guide won't work with Batches created manually from the web interface on ChronoScan Enterprise.
The first step on this guide is to enable the custom buttons for your configuration. Navigate to the
View Toolbar on the Scan/Input Tab. Click on the options menu and select customizable buttons.
You will see 5 new buttons showing up on the Form View. Click on the gear icon to see the customizable button properties on the
properties panel.
For this guide we will be using the first button. Click on the gear icon on the OnButtonClick section for the first button and add the following code on the script window:
|
Customizable buttons option on the View Toolbar
|
'EMAIL DOCUMENT
Set Batch = ChronoApp.GetCurrentBatch
Batchname = Batch.GetName
strSMTPFrom = "fromemail@domain.com"
strSMTPTo = "toemail@domain.com"
strSMTPRelay = "smtp.domain.com"
strTextBody = "This email was sent from ChronoScan"
'Change the UserField to whatever field meets your needs or just remove it from this part of the code
strSubject = "Document " & UserField_Invoice_number.value & "from batch " & Batchname
'This section will set the attachment that will be sent with the email message. strAttachment must contain a file path with the filename
FilePath = ChronoDocument.get_page_field_value(1,"SrcFile")
strAttachment = FilePath
'msgbox strAttachment
'These are set to match the google gmail server. Set these settings to match your smtp server settings.
Set oMessage = CreateObject("CDO.Message")
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "useremail@domain.com"
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "YOURPASSWORD"
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPRelay
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
oMessage.Configuration.Fields.Update
oMessage.Subject = strSubject
oMessage.From = strSMTPFrom
oMessage.To = strSMTPTo
oMessage.TextBody = strTextBody
oMessage.AddAttachment strAttachment
oMessage.Send
|
Those are the gear icons to access the code for OnButtonClick
|
You can also tweak the button title to whatever makes sense for your configuration.