Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

VS 2010 Email Source Code Problem

$
0
0
I'm very new to visual basic. Like days new and anyways I started to make a program. I found this code on the internet to send an email to myself, but it's flawed in a way that someone can find out my email password. I made the program and showed someone the .exe only to find that someone changed my email password. Luckily I got back in. Now what I'm wondering is if there's anyway to cover it up or keep someone from getting it. I don't even know how they did it in the first place unless they decompiled my .exe. If that's the case I need a way to make sure they can't do that or can't see my password. Here's the code.



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
Dim UserName As String = "EmailAdress"
Dim Password As String = "Password"
Dim mail As MailMessage = New MailMessage

mail.From = New MailAddress(UserName)
mail.To.Add(New MailAddress(UserName))
mail.Priority = MailPriority.High
mail.Subject = "SubjectLine"
mail.Body = "Info1 " + TextBox1.Text + vbNewLine + vbNewLine + "Info2 " + TextBox2.Text

mail.IsBodyHtml = True

Dim client As SmtpClient = New SmtpClient("smtp.gmail.com", 587)
client.EnableSsl = True
client.Credentials = New System.Net.NetworkCredential(UserName, Password)
Try
client.Send(mail)
Catch ex As Exception
MessageBox.Show("An error occured while processing your request. Please try again.")
If ProgressBar1.Value = 100 Then Timer1.Stop()
End Try

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>