Welcome to WebmasterWorld Guest from 34.204.176.189

Forum Moderators: ocean10000

Message Too Old, No Replies

Form Mailer

     
5:43 pm on Apr 3, 2009 (gmt 0)

New User

10+ Year Member

joined:Apr 3, 2009
posts: 3
votes: 0


Sorry for the dull question for most of you, but i'm just starting to learn ASP.NET and i came up with a problem. I'm trying to build a simple comment form that will be mailed to me. When i execute the page from my computer the following works just fine and sends out the email. But when i upload it to a server i get an error. Does anyone has an idea what can be the problem? Is it maybe that the server doesn't support something or its in the code? :/ Tx

Here is the code:

protected void Button1_Click(object sender, EventArgs e)
{
MailMessage message = new MailMessage(TextBox2.Text,"#*$!@gmail.com");
message.Subject = "Subject";
message.Body = TextBox3.Text;
SmtpClient client = new SmtpClient("rs.mt.net.mk");
client.Send(message);
}
8:24 pm on Apr 3, 2009 (gmt 0)

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:864
votes: 3


Can you put in the exact error it is returning.

But since I am writing this I am going to say there are a limited number of exceptions.

I am going to guess SmtpException is being thrown. The reasons for this usually are the following.

The connection to the SMTP server failed.
-or-
Authentication failed.
-or-
The operation timed out.

2:13 am on Apr 4, 2009 (gmt 0)

New User

10+ Year Member

joined:Apr 3, 2009
posts: 3
votes: 0


Here is the error in debug mode, line 27 marked red:

Unable to read data from the transport connection: net_io_connectionclosed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.

Source Error:

Line 25: //Send the message.
Line 26: SmtpClient client = new SmtpClient("rs.mt.net.mk");
Line 27: client.Send(message);
Line 28: // Add credentials if the SMTP server requires them.
Line 29: }

i really don't have a clue why it would execute just fine when i do "view in browser" but it doesnt when i upload it and try to start it from the server.

7:25 pm on Apr 5, 2009 (gmt 0)

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:864
votes: 3


My best guess is that the SMTP server in question only allows access to it from select IP blocks (aka your cable network). And when it was used outside of its allowed network, it just droped the connection in a rude fashion.

Try replacing "rs.mt.net.mk" with "127.0.0.1" and see if this works. This will send it though the local SMTP server on the server if there is one.

8:11 am on Apr 8, 2009 (gmt 0)

New User

10+ Year Member

joined:Apr 3, 2009
posts: 3
votes: 0


thanks mate, you were totally right. i transferred the website to my home ISP hosting account and everything works great now!
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members