Public Class Form1
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mail As New Net.Mail.MailMessage()
mail.From = New Net.Mail.MailAddress("soda_91@hotmail.com")
mail.To.Add("soda_91@hotmail.com")
mail.Subject = "I want it to send a TextBox1 here"
mail.Body = "TextBox2 and TextBox3 here!"
Dim smtp As New Net.Mail.SmtpClient("smtp.google.com")
smtp.Send(mail)
End Sub
End Class
I am getting frustrated, I keep getting the 571 Relay denied error when I try to send it....
I also need some getting the information in the textboxes get sent to the E-Mail as well..
I would REALLY appreciate any help.
Thanks :)

Problem with my VB program!
mamax
Can you help me get the code right please
Elfeffe
It wont send it only stall for 3 seconds then continue with no error >_<
DarkShadow
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mail As New Net.Mail.MailMessage()
mail.From = New Net.Mail.MailAddress("soda_91@hotmail.com")
mail.To.Add("soda_91@hotmail.com")
mail.Subject = "I want it to send a TextBox1 here"
mail.Body = "TextBox2 and TextBox3 here!"
Dim smtp As New Net.Mail.SmtpClient("mail.hotmail.com")
Dim cred As New System.Net.NetworkCredential("soda_91@hotmail.com", "youll never guess it X_X")
smtp.Credentials = cred
smtp.Send(mail)
End Sub
Weird one now, when i click the button it's like its sending it, it waits 3 seconds then carries on with NO ERROR, but I don't recieve the E-mail :S
Oh dear, I need some serious help :(
_Laci_
Are you sure it should work OK like that
Rodgers
If you look up SMTPClient in the help (Hit F1 with your cursor in SMTPClient() in the code window), it will give the settings required and some help in selecting the security.
The whole point of the server disabling relaying is to prevent spoofing and spamming: you need to have a valid login on the mail server (in this case the Google server).
You would add some code like:
Dim cred As New System.Net.NetworkCredential("MyUserName", "MyPassword")
smtp.Credentials = cred
Which will work.
Shiv Kumar
ok, i need to know how to come around this,
please help, thanks
Zipho Mfihlelwa
You will need to supply valid credentials before the host will 'relay' your message.
PradeepSattikar
Thanks a LOT I can't believe I got it to work at last!
What i needed was smtp.EnableSsl = True
I cant believe it was so easy ! :D
Now the last thing if you still want to help a bit, I want textbox1 to be the subject and textbox2 to be the body, if you can help me do this then I will be forever in your debt!
Thanks!
Darren5559
Pretty straightforward, really:
mail.Subject = TextBox1.Text
mail.Body = TextBox2.Text
jeff w smith
Can you send mail like that from a standard e-mail program
bad neighbor
Is there anyway to make it .Net 1.1 compatible, or even without .NET
Since most people tend to not have it :S
Jonathan Fife
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mail As New Net.Mail.MailMessage()
mail.From = New Net.Mail.MailAddress("coldsteelblade@gmail.com")
mail.To.Add("coldsteelblade@gmail.com")
mail.Subject = "I want it to send a TextBox1 here"
mail.Body = "TextBox2 and TextBox3 here!"
Dim smtp As New Net.Mail.SmtpClient("smtp.google.com")
Dim cred As New System.Net.NetworkCredential("ColdSteelBlade", "thepassword:P")
smtp.Credentials = cred
smtp.Send(mail)
End Sub
End Class
Still doesn't work.
I don't get how to use the SMTP, SMTPClient() doesnt work at all for me. :(
Marcelo Shiba