title: Send email using Script Task in SSIS with more than 8000 characters
body: <p>I'm trying to send an email using Script Task in email but have a few issues. 
  The body of the email is more than 8000 characters (HTML email) and it sends a blank email. I get the Body, EmailFrom, EmailTo and Subject from a function. (This is just one row. The body of the email gets generated using some views and some calculations) I have read that I need to use a foreach loop container and edit my script, but nothing is working atm for me.</p>
  
  <p>My SSIS Control Flow looks like: <br><br>
  1. Execute SQL Task: Select Body, From, To, Subject from dbo.Email_fn() <br>
  Result Set : single row <br> and Result Set mapped to variables in the same order with name (0,1,2,3) <br><br>
  2:Script Task: Read only variables: I have chosen all my variables from above.<br><br>
  My code looks like: (Please help me edit my code):<br><br>using System.Net.Mail;          // Added</p>
  
  <p>namespace ST_df6618207373422d961b80ca8b6a56e2
  {</p>
  
  <pre><code>{
      public void Main()
      {
  
          variables with hardcoded values.
          String SendMailFrom = Dts.Variables["SendMailFrom"].Value.ToString();
          String SendMailTo = Dts.Variables["SendMailTo"].Value.ToString();
          String SendMailSubject = Dts.Variables["SendMailSubject"].Value.ToString();
          String SendMailBody = Dts.Variables["SendMailBody"].Value.ToString();
  
  
           String SmtpServer = Dts.Variables["SmtpServer"].Value.ToString();
          String SmtpServer = Dts.Connections["My SMTP Connection Manager"].Properties["SmtpServer"].GetValue(Dts.Connections["My SMTP Connection Manager"]).ToString();
  
  
          MailMessage myHtmlFormattedMail = new MailMessage(SendMailFrom, SendMailTo, SendMailSubject, SendMailBody);
          myHtmlFormattedMail.IsBodyHtml = true;
  
  
          SmtpClient mySmtpClient = new SmtpClient(SmtpServer);
          mySmtpClient.Port = 2525; 
          mySmtpClient.Send(myHtmlFormattedMail);
  
  
          Dts.TaskResult = (int)ScriptResults.Success;
  </code></pre>
  
  <p><br><br></p>
  
  <p>This sends a blank email because the body is more than 8000 characters and it gets truncated. How do I rectify this???? Any help will be greatly appreciated.</p>