By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,290 Members | 1,263 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,290 IT Pros & Developers. It's quick & easy.

vb 2005 email

P: n/a
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("To**@ValidAddress.com")
EMsg.To.Add("To**@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("To**@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(S mtpReplyReader caller, Boolean oneLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(Sm tpReplyReader caller)
at System.Net.Mail.SmtpReplyReader.ReadLine()
at System.Net.Mail.SmtpConnection.GetConnection(Strin g 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
Feb 11 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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("To**@ValidAddress.com",
"ValidPassword", "mail.ValidAddress.com")

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

"Tony Mastracchio" <To******@MSN.Com> wrote in message
news:uP**************@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("To**@ValidAddress.com")
EMsg.To.Add("To**@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("To**@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(S mtpReplyReader
caller, Boolean oneLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(Sm tpReplyReader
caller)
at System.Net.Mail.SmtpReplyReader.ReadLine()
at System.Net.Mail.SmtpConnection.GetConnection(Strin g 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
Feb 12 '06 #2

P: n/a
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" <To******@MSN.Com> escribió en el mensaje news:uP**************@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("To**@ValidAddress.com")
EMsg.To.Add("To**@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("To**@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(S mtpReplyReader caller, Boolean oneLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(Sm tpReplyReader caller)
at System.Net.Mail.SmtpReplyReader.ReadLine()
at System.Net.Mail.SmtpConnection.GetConnection(Strin g 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
Feb 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.