Configuring IIS SMTP for System.Net.Mail

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • daokfella

    Configuring IIS SMTP for System.Net.Mail

    I'm having trouble using localhost to test the e-mail functions in my
    application. I keep getting the following error when sending mail:

    "Unable to read data from the transport connection: An existing
    connection was forcibly closed by the remote host."

    This is what I have in my config:

    <system.net>
    <mailSettings >
    <smtp from="noreply@m ytestsite.com">
    <network host="localhost " password="" userName="" port="25"
    defaultCredenti als="true" />
    </smtp>
    </mailSettings>
    </system.net>

    This is my code to send mail:

    Dim msg As New System.Net.Mail .MailMessage(_f rom, _to,
    _subject, _body)
    msg.IsBodyHtml = True
    Dim client As New Net.Mail.SmtpCl ient
    client.Send(msg )

    I get the error on the Send method. Anybody have any ideas? I'm
    guessing is something to do with IIS. I had no problems with
    System.Web.Mail , but I'm trying to use the new System.Net.Mail in my
    2.0 app without any luck.

    I was able to get things working using an SMTP server other than my
    localhost as long as I was sending mail to the same domain. I couldn't
    quite figure out the credentials part yet, so I thought I'd stick with
    localhost for the time being. Any ideas?

    Thanks,

    Jason

  • Alexey Smirnov

    #2
    Re: Configuring IIS SMTP for System.Net.Mail

    On Apr 30, 5:55 am, daokfella <jjbut...@hotma il.comwrote:
    I'm having trouble using localhost to test the e-mail functions in my
    application. I keep getting the following error when sending mail:
    >
    "Unable to read data from the transport connection: An existing
    connection was forcibly closed by the remote host."
    >
    This is what I have in my config:
    >
    <system.net>
    <mailSettings >
    <smtp from="nore...@m ytestsite.com">
    <network host="localhost " password="" userName="" port="25"
    defaultCredenti als="true" />
    </smtp>
    </mailSettings>
    </system.net>
    >
    This is my code to send mail:
    >
    Dim msg As New System.Net.Mail .MailMessage(_f rom, _to,
    _subject, _body)
    msg.IsBodyHtml = True
    Dim client As New Net.Mail.SmtpCl ient
    client.Send(msg )
    >
    I get the error on the Send method. Anybody have any ideas? I'm
    guessing is something to do with IIS. I had no problems with
    System.Web.Mail , but I'm trying to use the new System.Net.Mail in my
    2.0 app without any luck.
    >
    I was able to get things working using an SMTP server other than my
    localhost as long as I was sending mail to the same domain. I couldn't
    quite figure out the credentials part yet, so I thought I'd stick with
    localhost for the time being. Any ideas?
    >
    Thanks,
    >
    Jason
    Is the SMTP service started on the localhost?

    Comment

    • Juan T. Llibre

      #3
      Re: Configuring IIS SMTP for System.Net.Mail

      re:
      !I was able to get things working using an SMTP server other than my
      !localhost as long as I was sending mail to the same domain.

      1. Do you have an smtp server configured on that computer ?

      2. If you do, try setting up a domain alias for it ( Use the IIS Manager for that... )

      You can use your machine's name as a domain alias.





      Juan T. Llibre, asp.net MVP
      asp.net faq : http://asp.net.do/faq/
      foros de asp.net, en espaƱol : http://asp.net.do/foros/
      =============== =============== =====
      "daokfella" <jjbutera@hotma il.comwrote in message
      news:1177905347 .823758.298790@ l77g2000hsb.goo glegroups.com.. .
      I'm having trouble using localhost to test the e-mail functions in my
      application. I keep getting the following error when sending mail:
      >
      "Unable to read data from the transport connection: An existing
      connection was forcibly closed by the remote host."
      >
      This is what I have in my config:
      >
      <system.net>
      <mailSettings >
      <smtp from="noreply@m ytestsite.com">
      <network host="localhost " password="" userName="" port="25"
      defaultCredenti als="true" />
      </smtp>
      </mailSettings>
      </system.net>
      >
      This is my code to send mail:
      >
      Dim msg As New System.Net.Mail .MailMessage(_f rom, _to,
      _subject, _body)
      msg.IsBodyHtml = True
      Dim client As New Net.Mail.SmtpCl ient
      client.Send(msg )
      >
      I get the error on the Send method. Anybody have any ideas? I'm
      guessing is something to do with IIS. I had no problems with
      System.Web.Mail , but I'm trying to use the new System.Net.Mail in my
      2.0 app without any luck.
      >
      I was able to get things working using an SMTP server other than my
      localhost as long as I was sending mail to the same domain. I couldn't
      quite figure out the credentials part yet, so I thought I'd stick with
      localhost for the time being. Any ideas?
      >
      Thanks,
      >
      Jason
      >

      Comment

      Working...