Hello Creatio Community,
I'm creating a script task for email sender using a documentation from creatio team. I followed the provided instructions for creating the script task, but when I published the script task some errors occured.
Some of the classes and interface cannot be found also the IntegrationApi library cannot be found.
source code below :
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using Terrasoft.Common;
using Terrasoft.Core;
using Terrasoft.Core.Configuration;
using Terrasoft.Core.DB;
using Terrasoft.Core.Entities;
using Terrasoft.Core.Factories;
using Terrasoft.Core.Process;
using Terrasoft.Core.Process.Configuration;
using Terrasoft.Mail;
using Terrasoft.Mail.Sender;
using IntegrationApi;
var mailBoxSettingId = Get("SenderMailbox");
var emailClientFactory = ClassFactory.Get(
new ConstructorArgument("userConnection", UserConnection));
var emailSender = ClassFactory.Get(
new ConstructorArgument("emailClientFactory", emailClientFactory),
new ConstructorArgument("userConnection", UserConnection));
var entity = UserConnection.EntitySchemaManager.GetInstanceByName("MailboxSyncSettings").CreateEntity(Uif (entity.FetchFromDB("Id", mailBoxSettingId, new List { "SenderEmailAddress" })) {
var senderEmailAddress = entity.GetTypedColumnValue("SenderEmailAddress");
var message = new Terrasoft.Mail.Sender.EmailMessage {
From = senderEmailAddress,
To = Get("Recipient").Split(';').ToList(),
// Cc = List{ "first@recepient.co", "second@recepient.co"},
// Bcc = List{ "first@recepient.co", "second@recepient.co"},
Subject = Get("Subject"),
Body = Get("Body"),
Priority = Terrasoft.Mail.Sender.EmailPriority.Normal
};
var attachment = new Terrasoft.Mail.Sender.EmailAttachment {
Id = Guid.NewGuid(),
Name = "test.txt",
Data = Encoding.ASCII.GetBytes("some test text")
};
message.Attachments.Add(attachment);
emailSender.Send(message);
}
return true;
errors in lines :
var emailClientFactory = ClassFactory.Get(
var emailSender = ClassFactory.Get(
var message = new Terrasoft.Mail.Sender.EmailMessage {
Priority = Terrasoft.Mail.Sender.EmailPriority.Normal
var attachment = new Terrasoft.Mail.Sender.EmailAttachment {
Documents in this link:
page 14: https://academy.creatio.com/docs/sites/academy_en/files/pdf/node/1474/Sending_emails_.pdf
https://academy.creatio.com/docs/7-18/developer/application_components/…