title: How do I configure Windows Server 2008 R2 to allow sending of email from an Integrated Services Package in SQL Server
body: <p>How do I configure Windows Server 2008 R2 to allow sending of email from an Integrated Services Package in SQL Server?</p>
  
  <p>I am trying to send an email from an SSIS package that that has been imported into the MSDB stored packages.</p>
  
  <p>When I run the package I get the below error:</p>
  
  <blockquote>
    <p>[Send Mail Task] Error: An error occurred with the following error
    message: "Failure sending mail.  System.Net.WebException: Unable to
    connect to the remote server  System.Net.Sockets.SocketException: An
    attempt was made to access a socket in a way forbidden by its access
    permissions</p>
  </blockquote>
  
  <p>I have tried the same thing using a script task and <code>MailMessage()</code> and <code>SmtpClient()</code> in .NET and the task does not fail but it also does not send the email.</p>
  
  <p>As a sidenote: I know there is a website setup on the server through IIS that is able to send emails via port 25.</p>
  
  <p>I have given the package the same host IP address and port number, but it I still get an error.</p>
  
  <p>Does anyone know what I can troubleshoot for finding a way to make this work?</p>
  
  <p>Thanks</p>