Error "Unable To Read Data From The Transport Connection: Net_io_connectionclosed" When Trying To Send Email
Oct 9, 2010
I'm trying to send an email from my ASP.NET website using the following code (obviously replacing the hostname, username and password with the actual values):
Public Shared Sub Send(ByVal ToEmail As String, ByVal FromEmail As String, ByVal Subject As String, ByVal Message As String)
Dim mm As New MailMessage(FromEmail, ToEmail, Subject, Message)
Dim smtp As New SmtpClient("hostname")
smtp.Credentials = New NetworkCredential("username", "password")
smtp.Send(mm)
End Sub
When trying to send out the mail I'm receiving this error: "Unable to read data from the transport connection: net_io_connectionclosed."
using (MailMessage mm = new MailMessage("soporte@linknred.com", correo1.Text.Trim())) { mm.Subject = "Activacion de Cuenta"; string body = "Hola " + correo1.Text.Trim() + ", " + "Bienvenido a LinknRed"; body += "<br /><br />Por Favor haz Click en el Enlace Siguiente Para Activar Tu Cuenta";
I am trying to send a simple email through the following code:
protected void email_Click(object sender, EventArgs e) { System.Net.Mail.MailMessage msgMail = new System.Net.Mail.MailMessage(); msgMail.From = new System.Net.Mail.MailAddress("veerab@orbees.com"); msgMail.To.Add(new System.Net.Mail.MailAddress("murthyp@orbees.com")); msgMail.Subject = "Request:Joing into the myitem.Title.ToString()"; msgMail.IsBodyHtml = true; string strBody = "test mail"; msgMail.Body = strBody; System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(); }
I have installed the SMTP server on my local machine. The folders in mail root have all the permissions. My mails stay in the Queue folder for sometime and then they go to the Badmail folder. I am receiving the following error: Unable to deliver this message because the follow error was encountered: "This message is a delivery status notification that cannot be delivered.". The specific error code was 0xC00402C7. The message sender was <>. The message was intended for the following recipients.
I'm using Visual Studio 2008, and my database is SQL Server 2000.
I want to add a connection to the Server Explorer in VS. The Data source is Microsoft SQL Server (SqlClient). After entering in all my information and I click Test Connection, it is successful.
But when I click OK, I get the error:
Unable to add data connection. ExecuteScalar requires an open and available connection. The connection's current state is closed.
I have VS 2010 professional. I am trying to open "ASP.Net Configuration" through Project -> ASP.Net Configuration.
It pops up the Notification about the ASP.Net Development Server localhost but doesn't open ASP.Net Configuration in the default browser.I clicked on the Root Url (by double clicking on the 'development server' at the right bottom from Notification Manager).
It throws following error
"An error was encountered. Please return to the previous page and try again."
Clicking on "How do i use this tool".It opened page with error.
"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required."
I found this article as well http://www.google.com/support/forum/p/Google+Apps/thread?tid=2cbb54572fea6939&hl=en and worked through this but that did not resolve me issue either.
I am unable to understand. Hopefully someone out there has faced a similar issue and knows the fix. I am creating DAL for my project using class library. In my class library I want to store the connection string in APP.Config file and I have created and saved it.
The problem is when I try to access my connection string by name using ConfigurationManager.ConnectionStrings[Name], it returns null. When I try to access connection string using number like ConfigurationManager.ConnectionStrings[0] It returns a strange connection string i.e. (data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true)
I want to clearify here that I have not deployed the website yet and its on my local file system so there is no link of this library with IIS.
I have a strange problem with sending email via asp.net.
I adding to my email an attachment with long name ("Xxxxxxxx ąę łóxxxx yyyyyyyyyńęąąyy bbbbbbbbbb b wwwwwwwww wwwwwww ooooooooo" - polish chars included). Next I receiving that email with that file but I can't read the file. There is like damaged, with different name - ""=_utf-8_B_WHh4eHh4eHggxIXEmSDFgsOzeHh4eCB5" and the file size is a little bigger.
my website sends email just fine on another host. I should not really have to change anything to make it work on this webhost. However, I have followed the instructions for this host and it is not working. Here is my current web.config.
[Code]....
I am getting my mail message printed at the top of my browser with the correct information. Why isn't this going through the mail server?
I'm having some trouble with the asp.net FileUpload Control and sending email attachments.
I am able to run the following code and successfully create and attach 1 attachment to an email send mail it to myself with no problems.
[Code]....
I need to be able to handle multiple files and I am also saving the files to an sql database. I tried using multiple file upload controls (max 3) and can save the files to the database successfully, but any and all attachments that are emailed, appear corrupted in my inbox. So, I removed all the fileupload controls and left just on on the page. I created a generic List<Attachment> to store the attachments created from the fileupload control and then iterate through all entries and attach them to my email and save them to the database. Once again, saving to the database works perfectly and i can read the attachments back, but the email attachments are corrupt. Is there anything obvious that I am doing wrong?
I have a web application which will send email when user changes his/her passwords and also some invitation emails from the webpage.I have used VS2008 to develop this application. On my development machine the emails are send using the provided credentials as follows:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at
I am consuming a third party web service wsdl using my .net aps.net page. And I am getting following error message. Cannt get to resolve it. Its working on my machine but not in my development machine. I have installed the certificate also in certificates on that machine.
Error --> The underlying connection was closed: An unexpected error occurred on a send.
try { using (MailMessage mm = new MailMessage()) { mm.Subject = "Account Activation"; string body = "Hello"; mm.From = new MailAddress("support@foodtrove.in"); body += "<br /><br />Please click the following link to activate your account";
[Code]....
but catch exception service not available error ...
When a server error occurs for whatever reasons (YSOD), the server will send a message via SMTP class. In my case, my company employs microsoft exchange and uses NTLM authentication for all domain users. I am authenticating users via NTLA windows integrated authentication. My question is, is it possible to utilize this authentication data, and pass it to the system.web SMTP username/password authentication scheme to send an email to me (the web developer) when the error occurs? I am pretty sure my company requires a username/pwd to send emails via SMPT on the ms exchange server.
First I found that you can catch it and log it inside a catch, but this doesn't send an email. Then I found out about using the Error Signal class. That worked, however what wasn't apparent from reading, is that it treats the error like normal, so when I signal the error it goes to the custom error page still, I don't want that to happen. What I want to do is catch that error, log it, send the email, but stay on the page the error happened so I can provide special feedback. I do not want it go to the custom error page.
EDIT: This is what I have and it redirects me to the custom error page.
Try smtpClient.Send(mailMessage) Catch smtpEx As SmtpException errorSignal.FromCurrentContext().Raise(smtpEx) Catch ex As Exception errorSignal.FromCurrentContext().Raise(ex) End Try
Edit: Posting my web.config sections that involve Elmah (besides the connection string hah) And there is nothing in my Global.asax file involving Elmah.
Protected Sub Submitbutton_Click(sender As Object, e As System.EventArgs) Handles Submitbutton.Click Dim EMail1 As New MailMessage EMail1.From = New MailAddress("Receiver") EMail1.[To].Add(New MailAddress("Sender")) EMail1.Subject = Firstnametextbox.Text + lastnametextbox.Text + "Register " EMail1.Body = " This is content "
We're having an error similar to the one detailed here. We get the error noted above when trying to do AD authentication from our .net (3.5) mvc 2 app. This is our first .net mvc app ...
http://forums.asp.net/t/1161047.aspx
- We are re-using a forms auth library written for a .Net 2 app
- that library/app/config used a service account with min. privileges for binding to AD
- This error occurs in VS 2008, have not tried deploying the app to a server yet (a little early for that)
- like the other user at the previously referenced thread, I can get the 'unable to establish ...' error to go away and display the log on page by putting *MY* credentials in instead of the service account (but not successfully authenticate)
- moving the service account into the same AD OU as my account does not seem to change it ... only using my account credentials does.
- trust level is set to full
Is this some odd permissions trick that is new with .Net 3.5 (even though the ADmembershipProvider is still a 2.0 libary)? This should have nothing to do with MVC itself.
Config looks like this (very standard, like every one else's)
[Code]....
The line/portion highlighted in the debug/stacktrace is:
I have create user wizard control on my page as below with mail definition setup to send a welcome email to new registerd user.
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" requiresQuestionAndAnswer= "false" oncreateduser="CreateUserWizard1_CreatedUser" LoginCreatedUser="False"> <MailDefinition BodyFileName="~/EmailTemplates/CreateUserWizard.txt" From="myemailaddress" Subject="New User"> </MailDefinition> <WizardSteps> <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server" > <ContentTemplate> layout content here </ ContentTemplate> </WizardSteps > </asp:CreateUserWizard > Problem is I am not receiving the welcome email. To test it, I placed another create user wizard on another page in its default form as below <asp:CreateUserWizard ID="CreateUserWizard1" runat="server"> <MailDefinition BodyFileName="~/EmailTemplates/CreateUserWizard.txt" From="myemailaddress" Subject="New User"> </MailDefinition> <WizardSteps> <asp:CreateUserWizardStep runat="server" /> <asp:CompleteWizardStep runat="server" /> </WizardSteps> </asp:CreateUserWizard>
This one worked and I got welcome email. The setup in Web Config is correct. Is it because I have the oncreateduser="CreateUserWizard1_CreatedUser" or some other conflict issue.
Error at the transport level when sending a request to the server. (Provider: Shared Memory Provider, error: 0 - Since both ends of the canal there are no processes.)
I've got this exception on my Web Site every time after restarting my SqlServer on simple request like this :
if (System.Web.HttpContext.Current.User.IsInRole("Administrator"))
but after I do refresh the page with this codebehind error disappears.
How to handle this error and where it comes from ?