vb 2005 email

T

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("(e-mail address removed)")
EMsg.To.Add("(e-mail address removed)")
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("(e-mail address removed)", "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
 
K

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("(e-mail address removed)",
"ValidPassword", "mail.ValidAddress.com")

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

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("(e-mail address removed)")
EMsg.To.Add("(e-mail address removed)")
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("(e-mail address removed)",
"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
 
C

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" <[email protected]> escribió en el mensaje 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("(e-mail address removed)")
EMsg.To.Add("(e-mail address removed)")
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("(e-mail address removed)", "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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top