How to send the email/notification when documents/batch get to Verification?

Question

How to set up the notifications (email, etc.) to be sent when documents/batch get to the Verification stage?

Answer

In the Project (Batch Type) Properties > Workflow select Advanced workflow create a custom script stage, and place it right before the Verification stage

mceclip0.png

It is possible to add a script like the one below to send email notifications. This example sends the notification from the Gmail mailbox.

# C# .NET
using System;
using System.IO;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;

MailMessage message = new MailMessage();
SmtpClient smtp = new SmtpClient();
message.From = new MailAddress("mygmailaddress@gmail.com");
message.To.Add(new MailAddress("sendtoemailaddress"));
message.Subject = "Test";
message.IsBodyHtml = true; //to make message body as html
message.Body = "Verification Stage";
smtp.Port = 587;
smtp.Host = "smtp.gmail.com"; //for gmail host
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("mygmailaddress@gmail.com", "mypassword");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(message);

Have more questions? Submit a request

Comments

9 comments

  • Avatar

    Thong Pham Hoang Nguyen

    Hi,

    I tried but ABBYY didn't send mail, is there any system requirement or need to be Cloud version,...

    Thank you.

    0
  • Avatar

    Ban Tran

    Hi Thong,

    The script should work if you are using Gmail as the sender because the configuration setting is for Gmail.

    Since it is C#, my guess is you need to have the .Net framework installed. I just test the script again to make and it worked when I provide my Gmail address.

    One possible setting you may check when you are using the Gmail address is to go into your Gmail settings and under the Security option, make sure the "Less secure app access" is turned ON.

    1
  • Avatar

    Thong Pham Hoang Nguyen

    Hi Ban Tran,

    Thanks for your detailed explanation.

    I tried running the workflow on FlexiCapture but it doesn't seem to work. Does this Workflow require uploading to the ABBYY server (Distributed) or Cloud version? Does this script work with other mail servers or only accept Gmail? I think it accepts all mail servers because this is just a script haha

     

    0
  • Avatar

    Ban Tran

    Hi Thong,

    The script is part of the Workflow so as long as you import the document thru the Workflow process, then it will work. So it doesn't require to be uploaded to the Server or Cloud. But of course, if you want to process your document automatically then uploading the project to the server (Distributed/Cloud) is the way to go.

    For example, regardless you are using the local project or the project that was uploaded to the Server (Distributed), if you manually drag & drop the image into the project, then it will not work as the way you import the image is not part of the workflow.

    If you set up the images to import from Hotfolder, Email (pop3/imap/mapi/msgraph), FTP, sFTP, etc.. then the FlexiCapture project will process these images as part of the workflow.

    Regarding the script, as you already said, it is just a script so it should work with others as well, just this example I'm using Gmail so I provide the configuration for Gmail. For example, if you process with Yahoo mail then the configuration will be different (and you will need to check from the Yahoo site to see what are its configuration to send out the email. For example, the Port and the Host will be different than Gmail).

    0
  • Avatar

    Mariusz Dudka

    Hi Ban Tran,

    Is it possible to insert an email sender in "sendtoemailaddress" (so that the notification of a waiting document goes to the owner of the message)?
    SMTP server is set as the import.
    I will be grateful for your response.

    Regards

    Mariusz Dudka

    0
  • Avatar

    Ban Tran

    Hi Mariusz,

    Yes, it also works too when you set the "sendtoemailaddress" with the sender's email address.

    Regards,

    Ban

    0
  • Avatar

    Samir Waikar

    Hi Ban,

    I want to include the sender of document ie Vendor's email id from where doc is imported into 

    message.To.Add(new MailAddress("sendtoemailaddress")); 

    What Changes need to do?
    1
  • Avatar

    Ranjit Nayak

    Samir Waikar did you find something? I have similar case.

    0
  • Avatar

    Ranjit Nayak

    Hi Ban,

    This is a good info. I want use the similar stage where  I want to send with rejected files either in attachments which are rejected or with path. But that should be once the file is rejected from a batch.

    Please guide.

    0

Please sign in to leave a comment.