Testing Emailpage not possible

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I developed an "Contact Us" - page with VS 2005 and ASP.NET 2.0.
By clicking the send button the following code is executed:

Configuration config =
WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);

MailMessage mailBericht = new
MailMessage(txtbxEmailadres.Text.Trim(),
config.AppSettings.Settings["contactMailAdres"].Value.Trim());
mailBericht.Subject = "Mailbericht vanaf website";
mailBericht.Body = txtbxBericht.Text + "\n" + txtbxNaam.Text.Trim()
+ "\n" + txtbxTelefoon.Text.Trim();

SmtpClient smtp = new
SmtpClient(config.AppSettings.Settings["mailserver"].Value,
int.Parse(config.AppSettings.Settings["mailPort"].Value.ToString()));

smtp.UseDefaultCredentials = true;
smtp.Send(mailBericht);


The mailserver-key contains "localhost".
The port is 1607 (but i've tried port 25 also).

I'm using the built-in webserver from VS2005 on an XP Home Edition-machine.

The codeline "smtp.Send(mailBericht);" throws the following exception:
"Smtp server returned an invalid response"

I can't figure out what 's wrong.
I guess that the problem is caused within the built-in webserver.

Is it anyway possible to send mail from the built-in webser in conjunction
with an XP Home Edition-machine?

greetings
Ruud
 
By built-in web server, I assume you mean the built-in VS.Net 2005 web
server. The question is, what is the SMTP server you are trying to pass
through. Windows XP Home won't have one builtin as the nromal one is part of
IIS. Unless you're running a third-party SMTP server, then it should throw
an error just as you're seeing since there isn't a valid SMTP listener on
port 25 to give a meaningful response.
 
Thanks.

I managed the problem by sending the mail to the mailserver of my regular
provider. That works.

Mark Fitzpatrick said:
By built-in web server, I assume you mean the built-in VS.Net 2005 web
server. The question is, what is the SMTP server you are trying to pass
through. Windows XP Home won't have one builtin as the nromal one is part of
IIS. Unless you're running a third-party SMTP server, then it should throw
an error just as you're seeing since there isn't a valid SMTP listener on
port 25 to give a meaningful response.

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006



Ruud Ortmans said:
Hi,

I developed an "Contact Us" - page with VS 2005 and ASP.NET 2.0.
By clicking the send button the following code is executed:

Configuration config =
WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);

MailMessage mailBericht = new
MailMessage(txtbxEmailadres.Text.Trim(),
config.AppSettings.Settings["contactMailAdres"].Value.Trim());
mailBericht.Subject = "Mailbericht vanaf website";
mailBericht.Body = txtbxBericht.Text + "\n" + txtbxNaam.Text.Trim()
+ "\n" + txtbxTelefoon.Text.Trim();

SmtpClient smtp = new
SmtpClient(config.AppSettings.Settings["mailserver"].Value,
int.Parse(config.AppSettings.Settings["mailPort"].Value.ToString()));

smtp.UseDefaultCredentials = true;
smtp.Send(mailBericht);


The mailserver-key contains "localhost".
The port is 1607 (but i've tried port 25 also).

I'm using the built-in webserver from VS2005 on an XP Home
Edition-machine.

The codeline "smtp.Send(mailBericht);" throws the following exception:
"Smtp server returned an invalid response"

I can't figure out what 's wrong.
I guess that the problem is caused within the built-in webserver.

Is it anyway possible to send mail from the built-in webser in conjunction
with an XP Home Edition-machine?

greetings
Ruud
 
Back
Top