EMAIL Help through SSIS/C#

  • Hi Guys,

    Need help. I am running an SSIS Package at the end I am sending to the users Package runs a file and Please pick up the file from a network drive.

    My question is how can I add HyperLink (My network driver and folder) link to the user can hit the link once they receive the email. Any help would

    be great appreciate.

    Thank You.

    Here are my code that I am using in "SCRIPT TASK/C#" in SSIS

    First Step:- Three Variables in SSIS

    SendMailFrom = Value is my email add

    SendMailTo = Value is my email add

    Send MailSubject = Value "Test Email"

    My SMTP Connection Manager = my SMTP Connection

    public void Main()

    {

    String SendMailFrom = Dts.Variables["SendMailFrom"].Value.ToString();

    String SendMailTo = Dts.Variables["SendMailTo"].Value.ToString();

    String SendMailSubject = Dts.Variables["SendMailSubject"].Value.ToString();

    String SendMailBody = "Please Click : <a href= http://www.google.com></a&gt;";

    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.Send(myHtmlFormattedMail);

    Dts.TaskResult = (int)ScriptResults.Success;

    }

    Note:- Just for testing I am passing "WWW.GOOGLE.COM". But It will be our company Network drive.

    Please advise.

  • What happens when running with the code you posted? Does the hyperlink appear at all?

    Your HTML syntax is a little bit wrong. Check this page.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • After I receive email.I am seeing only "Please Click :" in the email body.

    Which link?

  • rocky_498 (10/19/2016)


    After I receive email.I am seeing only "Please Click :" in the email body.

    Which link?

    The one hyperlinked by the word 'this'.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply