Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2006, 01:47 PM
Registered User
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error sending email

This is the code I use to send my form via email:
Code:
protected void sendMail(string strFrom, string strBody)
    {
        //create the mail message
        MailMessage mail = new MailMessage();

        //set the addresses
        mail.From = new MailAddress(strFrom);
        mail.To.Add("myEmail@myDomain.com");

        //set the content
        mail.Subject = txtSubject.Text;
        mail.Body = strBody;
        mail.IsBodyHtml = false;

        //send the message
        SmtpClient smtp = new SmtpClient("noAuth.myDomain.com");
        smtp.Send(mail);
    }
And this is the error message I received:
Quote:
quote:
Server Error in '/home' Application.
--------------------------------------------------------------------------------

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 84: //send the message
Line 85: SmtpClient smtp = new SmtpClient("noAuth.myDomain.com");
Line 86: smtp.Send(mail);
Line 87: }
Line 88: }

Source File: e:\wwwroot\home\email.aspx.cs Line: 86
 
Old April 20th, 2006, 01:58 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Hope this helps. I use this for sending mails from my applications

http://ganeshprof.blogspot.com/2006/...plication.html

Regards
Ganesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
sending email using .net 1.1 socket error amol.mahajan85@gmail.com ASP.NET 1.0 and 1.1 Basics 1 December 17th, 2006 06:25 PM
Sending Email function got error Evil_Vios ASP.NET 2.0 Professional 0 September 5th, 2006 04:35 AM
error sending email with attachment using CDO archanahs Classic ASP Professional 1 May 25th, 2006 08:16 AM
Error in sending email from asp.net asif_sharif ASP.NET 1.0 and 1.1 Professional 4 January 7th, 2006 05:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.