Configuring IIS SMTP for System.Net.Mail

D

daokfella

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="(e-mail address removed)">
<network host="localhost" password="" userName="" port="25"
defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>

This is my code to send mail:

Dim msg As New System.Net.Mail.MailMessage(_from, _to,
_subject, _body)
msg.IsBodyHtml = True
Dim client As New Net.Mail.SmtpClient
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
 
G

Guest

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="(e-mail address removed)">
<network host="localhost" password="" userName="" port="25"
defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>

This is my code to send mail:

Dim msg As New System.Net.Mail.MailMessage(_from, _to,
_subject, _body)
msg.IsBodyHtml = True
Dim client As New Net.Mail.SmtpClient
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?
 
J

Juan T. Llibre

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top