Hi @Christopher Jack ,
1.Please add error flow redirection in Data Flow Task.
2.Please use Script Task to send the error text file to email. We can use the following script in Script Task:
public void Main()
{
string subject = "Package Information";
string body = " ";
string MailFrom = " @outlook.com";
string MailTo = " @outlook.com";
string file = @"C:\Test\ErrorRows.txt"; //Add attach File
string password = " "; //MailFrom password
int port = 587;
string server = "smtp.live.com";
string userName = " @outlook.com"; //MailFrom
Boolean IsBodyHtml = true;
SendMailMessage(MailFrom, MailTo, subject, body, IsBodyHtml, server, port, userName, password, file); //Add file
Dts.TaskResult = (int)ScriptResults.Success;
}
public void SendMailMessage(string From, string SendTo, string Subject, string Body, Boolean IsBodyHtml, string Server, int Port, string UserName, string Password, string file) //Add file
{
MailMessage htmlMessage;
SmtpClient mySmtpClient;
try
{
htmlMessage = new MailMessage(From, SendTo, Subject, Body);
htmlMessage.IsBodyHtml = IsBodyHtml;
htmlMessage.Attachments.Add(new Attachment(file)); //Add file
mySmtpClient = new SmtpClient(Server, Port);
mySmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mySmtpClient.UseDefaultCredentials = false;
mySmtpClient.Credentials = new System.Net.NetworkCredential(UserName, Password);
mySmtpClient.EnableSsl = true;
mySmtpClient.Send(htmlMessage);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Best Regards,
Mona
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hot issues in November--What can I do if my transaction log is full?
Hot issues in November--How to convert Profiler trace into a SQL Server table?