title: ssis smtp mail task /connection ,how to mention the port number if the port number is not 25
body: <p>It has benn understood that the smtp mail task does not work if the port number is not 25.So found some script to do the work from the link</p>
  
  <p><a href="http://englestone.blogspot.co.uk/2008/05/ssis-send-mail-task-change-smtp-port.html" rel="nofollow">http://englestone.blogspot.co.uk/2008/05/ssis-send-mail-task-change-smtp-port.html</a></p>
  
  <p>when modified as per my needs it shows 
  "SMTP server requires a secure connection or the client was not authenticated"</p>
  
  <p>question is how to add the secure connection section on this vb code
     or
  is this error is ue to authentication then the code corresponding to authentication is correct?</p>
  
  <p>Please find the script</p>
  
  <pre><code>Public Sub Main()
          Dim myHtmlMessage As MailMessage
          Dim mySmtpClient As SmtpClient
  
  
  
          myHtmlMessage = New MailMessage("sender@s.com", "receiver@s.com", "subject", "body")
          mySmtpClient = New SmtpClient("send.company.net")
          mySmtpClient.Port = 587
          mySmtpClient.Credentials = CredentialCache.DefaultNetworkCredentials("sender@s.net", "sender email pwd")
  
  
  
  
          mySmtpClient.Send(myHtmlMessage)
       Dts.TaskResult = ScriptResults.Success
      End Sub
  </code></pre>
  
  <p>Any Vb.net/smtp/ expert please reply</p>