Question:
Sending Visual Basic form via email?
2009-08-22 22:20:38 UTC
I have scoured forums and help topics ALL day with no avail. Hence, I am asking you!

I am creating a basic web browser in VB just for kicks. I have created a feedback form with different text boxes, check boxes and such. I want to compile all those into one email, so that the feedback they submit will be forwarded to my email address.

All the email checks work, and it ensures each box is filled in. Once it tries to send, I receive an error message saying "error sending mail."

Any help on how to fix this issue?

Heres my code so far:

[[BEGIN VB CODE]]

If Int = 6 Then
Complete = True
MsgBox("Please wait. Sending feedback.")
Using message As New MailMessage()
message.From = New MailAddress(TextBox2.Text.ToString())
message.[To].Add(New MailAddress("holmesey91@gmail.com"))
message.Subject = "Message via Happy Browse feedback from " + TextBox1.Text.ToString()
message.Body = "Sender: " + TextBox2.Text.ToString()
message.Body = "Name: " + TextBox1.Text.ToString()
message.Body = "Improve: " + TextBox3.Text.ToString()
message.Body = "Stay: " + TextBox4.Text.ToString()
message.Body = "Features: " + TextBox5.Text.ToString()
message.Body = "Heard: " + ComboBox1.Text.ToString()
message.Body = "Browsers: " + CheckedListBox1.CheckedItems.ToString()
message.Body = "Rating: " + NumericUpDown1.Value.ToString()
Dim client As New SmtpClient()
client.Host = "127.0.0.1"
client.Send(message)
MsgBox("Thank you again! Feedback recieved.")
End Using
Me.Close
End If

[[END VB CODE]]
Four answers:
Ratchetr
2009-08-22 22:54:09 UTC
Is there an SMTP **SERVER** running on the machine that is running this code? The 127.0.0.1 address says to find the SMTP server on localhost, but most machines do NOT have an SMTP server running. You usually use an external SMTP server (gmail works well for this).



Try this from a command prompt on your test machine:

telnet 127.0.0.1 25

If the connection fails, you don't have a reachable SMTP server.



If you do have an SMTP server, but it's still failing, check your antivirus software. Some will block outgoing SMTP requests from unknown software. You may need to disable SMTP checking, or add an exception for your program.
xochitl
2016-11-06 16:27:36 UTC
Visual Basic Send Email
Helpful Harry
2009-08-24 11:14:25 UTC
Private objMailMsg As MailMessage

Private objSMTPClient As Net.Mail.SmtpClient = New Net.Mail.SmtpClient()



objMailMsg = New MailMessage(bdyfrom, bdyto)

objMailMsg.Subject = bdysub

objMailMsg.Body = bdymsg

objMailMsg.Priority = MailPriority.High

objMailMsg.IsBodyHtml = True

objSMTPClient.Host = smp

objSMTPClient.Send(objMailMsg)





To answer your other question set:

message.Body &= ""

instead of message.Body = ""





Dane
anto
2009-08-22 23:24:04 UTC
Host smtp.gmail.com

Port 465



And you should use OpenSSL ( that's how I did it )


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...