Home All Groups Group Topic Archive Search About
Author
11 Feb 2006 5:18 PM
Tony Mastracchio
Trying to send email via vb 2005 win form. I'm able to send email out via Outlook express from this account and I verified everything 100 times, I don't think it's my host email server.
I can't figure out what I'm doing wrong.
Any help?

I've got this code

Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim EMsg As New System.Net.Mail.MailMessage
EMsg.From = New MailAddress("T***@ValidAddress.com")
EMsg.To.Add("T***@ValidAddress.com")
EMsg.Subject = "this is a test email"
EMsg.Body = "this is the body of the email"
'EMsg.IsBodyHtml = True
'send the message
Dim smtp As New SmtpClient("http://mail.ValidAddress.com")
smtp.Credentials = New Net.NetworkCredential("T***@ValidAddress.com", "ValidPassword", "mail.ValidAddress.com")
Try
    smtp.Send(EMsg)
Catch ex As Exception
'    MsgBox(ex.ToString)
    txtMessage.Text = ex.ToString
End Try
End Sub

I get this Error

System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.
   at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)
   at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)
   at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
   at System.Net.Mail.SmtpReplyReader.ReadLine()
   at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
   at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
   at System.Net.Mail.SmtpClient.GetConnection()
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   --- End of inner exception stack trace ---
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at EMail.Form1.btnSend_Click(Object sender, EventArgs e) in C:\Documents and Settings\Tony\My Documents\Visual Studio 2005\Projects\EMail\EMail\Form1.vb:line 20

Thanks

Author
12 Feb 2006 1:22 AM
Ken Tucker [MVP]
Tony,

        You smtp server is wrong it should be something like this.

Dim smtp As New SmtpClient("mail.ValidAddress.com")
smtp.Credentials = New Net.NetworkCredential("T***@ValidAddress.com",
"ValidPassword", "mail.ValidAddress.com")

Ken
----------------------

"Tony Mastracchio" <TonyM***@MSN.Com> wrote in message
news:uPL158yLGHA.3196@TK2MSFTNGP09.phx.gbl...
Trying to send email via vb 2005 win form. I'm able to send email out via
Outlook express from this account and I verified everything 100 times, I
don't think it's my host email server.
I can't figure out what I'm doing wrong.
Any help?

I've got this code

Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSend.Click
Dim EMsg As New System.Net.Mail.MailMessage
EMsg.From = New MailAddress("T***@ValidAddress.com")
EMsg.To.Add("T***@ValidAddress.com")
EMsg.Subject = "this is a test email"
EMsg.Body = "this is the body of the email"
'EMsg.IsBodyHtml = True
'send the message
Dim smtp As New SmtpClient("http://mail.ValidAddress.com")
smtp.Credentials = New Net.NetworkCredential("T***@ValidAddress.com",
"ValidPassword", "mail.ValidAddress.com")
Try
    smtp.Send(EMsg)
Catch ex As Exception
'    MsgBox(ex.ToString)
    txtMessage.Text = ex.ToString
End Try
End Sub

I get this Error

System.Net.Mail.SmtpException: Failure sending mail. --->
System.IO.IOException: Unable to read data from the transport connection:
net_io_connectionclosed.
   at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer,
Int32 offset, Int32 read, Boolean readLine)
   at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader
caller, Boolean oneLine)
   at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader
caller)
   at System.Net.Mail.SmtpReplyReader.ReadLine()
   at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
   at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
   at System.Net.Mail.SmtpClient.GetConnection()
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   --- End of inner exception stack trace ---
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at EMail.Form1.btnSend_Click(Object sender, EventArgs e) in C:\Documents
and Settings\Tony\My Documents\Visual Studio
2005\Projects\EMail\EMail\Form1.vb:line 20

Thanks
Author
13 Feb 2006 11:26 AM
Carlos J. Quintero [VB MVP]
Hi Tony,

See if the problem is addressed here:

http://systemwebmail.com/

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com


  "Tony Mastracchio" <TonyM***@MSN.Com> escribió en el mensaje news:uPL158yLGHA.3196@TK2MSFTNGP09.phx.gbl...
  Trying to send email via vb 2005 win form. I'm able to send email out via Outlook express from this account and I verified everything 100 times, I don't think it's my host email server.
  I can't figure out what I'm doing wrong.
  Any help?

  I've got this code

  Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
  Dim EMsg As New System.Net.Mail.MailMessage
  EMsg.From = New MailAddress("T***@ValidAddress.com")
  EMsg.To.Add("T***@ValidAddress.com")
  EMsg.Subject = "this is a test email"
  EMsg.Body = "this is the body of the email"
  'EMsg.IsBodyHtml = True
  'send the message
  Dim smtp As New SmtpClient("http://mail.ValidAddress.com")
  smtp.Credentials = New Net.NetworkCredential("T***@ValidAddress.com", "ValidPassword", "mail.ValidAddress.com")
  Try
      smtp.Send(EMsg)
  Catch ex As Exception
  '    MsgBox(ex.ToString)
      txtMessage.Text = ex.ToString
  End Try
  End Sub

  I get this Error

  System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.
     at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)
     at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)
     at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
     at System.Net.Mail.SmtpReplyReader.ReadLine()
     at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
     at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
     at System.Net.Mail.SmtpClient.GetConnection()
     at System.Net.Mail.SmtpClient.Send(MailMessage message)
     --- End of inner exception stack trace ---
     at System.Net.Mail.SmtpClient.Send(MailMessage message)
     at EMail.Form1.btnSend_Click(Object sender, EventArgs e) in C:\Documents and Settings\Tony\My Documents\Visual Studio 2005\Projects\EMail\EMail\Form1.vb:line 20

  Thanks