title: Net.Mail.SmtpClient Not sending to external emails
body: <p>Hey guys i am using a function that will essentially send all emails out to users. However it only emails to users that are on our servers. Anyone that is using @gmail or @hotmail, do not seem to be getting our emails at all. Here is the code. Again this works for my server emails but external emails are not going out.</p>
  
  <p>The website is hosted on our servers.</p>
  
  <pre><code>Public Function SendMail(ByVal EmailFrom As String, ByVal EmailTo As String, ByVal EmailBcc As String, ByVal EmailSubject As String, ByVal EmailBody As String, ByVal Attachment As String) As Boolean
  
      Dim EmailMessage As New Net.Mail.MailMessage
      EmailMessage = New Net.Mail.MailMessage(EmailFrom, EmailTo, EmailSubject, EmailBody)
  
      If EmailBcc &lt;&gt; "" Then
          EmailMessage.Bcc.Add(EmailBcc)
      End If
  
      Dim MailClient As New Net.Mail.SmtpClient("exchange1", 25)
      MailClient.UseDefaultCredentials = False
      '        MailClient.EnableSsl = False
      EmailMessage.IsBodyHtml = True
  
      If Attachment &lt;&gt; "" Then
          Dim EMailAttachment As New System.Net.Mail.Attachment(Attachment)
          EmailMessage.Attachments.Add(EMailAttachment)
      End If
  
      Try
          MailClient.Send(EmailMessage)
          Return True
      Catch ex As Exception
          'MsgBox("Email Error: " &amp; ex.Message)
          '            Return False
      End Try
  
  End Function
  </code></pre>
  
  <p>EDIT: Can anyone explain why emails are sent when i deploy to my webserver, but not when im in my localhost iis?</p>