Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Here is a screen shot of the Actual program: http://oi57.tinypic.com/2hnxcb6.jpg

I want the program to produce the serial and to be able to enter any email to it and hit send that it will email that person the serial. The only problem is when I hit the send button nothing actually happens! How do I fix this and have emails actually be sent out. I configured it to the "smtp.gmail.com" server and my gmail email and password accordingly and still had no luck! I am using Visual Studio 2013 if that means anything. Here is the code:

VB
Imports System.Net.Mail
 
Public Class Form1
 
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
 
End Sub
 
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim objRandom As New System.Random(CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))
Dim Random1 As String
Dim Random2 As String
Dim Random3 As String
Dim Random4 As String
Dim Random5 As String
 
Random1 = objRandom.Next(100, 999)
Random2 = objRandom.Next(1000, 9999)
Random3 = objRandom.Next(1000, 9999)
Random4 = objRandom.Next(1000, 9999)
Random5 = objRandom.Next(1000, 9999)
 
TEXBOX1.Text = "Code" + Random1 
 
End Sub
 
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
MsgBox("Yaz's Employee Verification Build 1.0")
 
End Sub
 
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Close()
End Sub
 
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Dim MyMailMessage As New MailMessage()
Try
MyMailMessage.From = New MailAddress(" norply@norply.com ")
MyMailMessage.To.Add(TEXBOX1.Text)
MyMailMessage.Subject = "Subject here"
MyMailMessage.Body = "Body of message goes here"
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.Port = 587
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("Your E-Mail", "your Password")
SMTP.Send(MyMailMessage)
MsgBox("Email has been sent!", MsgBoxStyle.Information, "Serial Code")
Me.Close()
Catch ex As Exception
 
End Try
End Sub
End Class
Posted
Updated 22-Jul-14 7:14am
v2
Comments
[no name] 22-Jul-14 12:57pm    
And what is the exception you are getting?
Member 10951391 22-Jul-14 13:15pm    
"A first chance exception of type 'System.FormatException' occurred in System.dll"
[no name] 22-Jul-14 13:23pm    
And where are you getting this exception?
Member 10951391 22-Jul-14 13:27pm    
In the debugger console in Visual Studio I am using its feature to run the program before finalizing it. Here is a screen shot: http://i61.tinypic.com/jv5e7t.png
[no name] 22-Jul-14 13:31pm    
So you can't debug your own application?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900