using System.Net;
using System.Net.Mail;
public void Main()
// TODO: Add your code here
            string EmailSender = “senter@gmail.com”;
            string EmailRecipient = “recipient@gmail.com”;
            string EmailServer = “smtp.gmail.com“;
            string EmailBody = “Hello SSIS”;
            Attachment myAttachment = new Attachment(“C:\\Users\\\H007\\Desktop\\Test.txt”);
            MailMessage myhtmlMessage = new MailMessage(EmailSender,EmailRecipient,”Result of import”, EmailBody);
            SmtpClient mysmtpclient =  new SmtpClient(EmailServer,587);
            mysmtpclient.EnableSsl = true;
            System.Net.NetworkCredential crediantials =  new NetworkCredential(EmailSender,“Password”);
            mysmtpclient.UseDefaultCredentials = false;
            mysmtpclient.Credentials = crediantials;
Dts.TaskResult = (int)ScriptResults.Success;
        #region ScriptResults declaration
        /// <summary>
        /// This enum provides a convenient shorthand within the scope of this class for setting the
        /// result of the script.
        /// This code was generated automatically.
        /// </summary>
        enum ScriptResults
            Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
            Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation