jackjackkiwi
New member
- Joined
- Aug 15, 2011
- Messages
- 4
- Programming Experience
- 1-3
I got my last problem to work but now i have a new one. My program works great on my computer(where i made it) but every other computer i try to open it on it gives an error message. the program doesnt even come up just the error msg. Ive tried it on 2 computers that both have .net with no luck.
If you want to try to open the file yourself here is the link to download:
Script(although I think it is working fine):
Imports System.Net.Mail
Public Class Form1
Dim y As Integer
Dim x As Integer
Dim z As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text.ToLower.Contains("@hotmail") Or TextBox1.Text.ToLower.Contains("@live") Or TextBox1.Text.ToLower.Contains("@msn") Then
x = 4
ElseIf TextBox1.Text.ToLower.Contains("@gmail") Then
x = 2
y = 2
z = 1
ElseIf TextBox1.Text.ToLower.Contains("@aol") Then
x = 2
y = 3
z = 1
ElseIf TextBox1.Text.ToLower.Contains("@yahoo") Then
x = 5
End If
'-----------------------------------------------------------------------------------------------------------------
'This is for Yahoo
If x = 5 Then
start1:
Dim oSmtp As New EASendMailObjLib.Mail
Form2.Label2.Text = Val(Form2.Label2.Text) + 1
oSmtp.LicenseCode = "TryIt"
oSmtp.FromAddr = TextBox1.Text
oSmtp.AddRecipientEx(TextBox3.Text, 0)
oSmtp.Subject = TextBox5.Text
oSmtp.BodyText = RichTextBox1.Text
oSmtp.ServerAddr = "smtp.mail.yahoo.com"
oSmtp.UserName = TextBox1.Text
oSmtp.Password = TextBox2.Text
oSmtp.ServerPort = 465
oSmtp.SSL_init()
If oSmtp.AddAttachment(TextBox6.Text) <> 0 Then
End If
If oSmtp.SendMail() = 0 Then
Form2.Show()
Else
MsgBox("ERROR" & oSmtp.GetLastErrDescription())
End If
'-----------------------------------------------------------------------------------------------------------------------------
'Multiple
If RadioButton1.Checked Then GoTo start1
ElseIf z = 1 Then
start2:
Dim oSmtp As New EASendMailObjLib.Mail
'--------------------------------------------------------------------------------------------------------------------
'This is for AOL and Gmail
Dim smtpServer As New SmtpClient
Dim mail As New MailMessage()
smtpServer.Credentials = New Net.NetworkCredential(TextBox4.Text, TextBox2.Text)
Form2.Label2.Text = Val(Form2.Label2.Text) + 1
If x = 1 Then smtpServer.Port = 465
If x = 2 Then smtpServer.Port = 587
If x = 3 Then smtpServer.Port = 995
If y = 1 Then smtpServer.Host = "smtp.live.com"
If y = 2 Then smtpServer.Host = "smtp.gmail.com"
If y = 3 Then smtpServer.Host = "smtp.aol.com"
If y = 4 Then smtpServer.Host = "smtp.mail.yahoo.com"
smtpServer.EnableSsl = True
mail = New MailMessage()
mail.From = New MailAddress(TextBox1.Text)
mail.To.Add(TextBox3.Text)
mail.Subject = TextBox5.Text
mail.Body = RichTextBox1.Text
If TextBox6.Text.Contains(Text) Then mail.Attachments.Add(New Attachment(TextBox6.Text, "Text/plain"))
smtpServer.Send(mail)
If RadioButton1.Checked = False or true Then Form2.Show()
'-----------------------------------------------------------------------------------------------------------------------------
'Multiple
If RadioButton1.Checked Then GoTo start2
'-----------------------------------------------------------------------------------------------------------------------
'This is for HotMail, Live, or MSN
ElseIf x = 4 Then
start3:
Dim oSmtp As New EASendMailObjLib.Mail
Form2.Label2.Text = Val(Form2.Label2.Text) + 1
oSmtp.LicenseCode = "TryIt"
oSmtp.FromAddr = TextBox1.Text
oSmtp.AddRecipientEx(TextBox3.Text, 0)
oSmtp.Subject = TextBox5.Text
oSmtp.BodyText = RichTextBox1.Text
oSmtp.ServerAddr = "smtp.live.com"
oSmtp.UserName = TextBox1.Text
oSmtp.Password = TextBox2.Text
oSmtp.ServerPort = 587
oSmtp.SSL_init()
If oSmtp.AddAttachment(TextBox6.Text) <> 0 Then
End If
If oSmtp.SendMail() = 0 Then
Form2.Show()
Else
MsgBox("ERROR" & oSmtp.GetLastErrDescription())
End If
End If
'-----------------------------------------------------------------------------------------------------------------------------
'Multiple
If RadioButton1.Checked Then GoTo start3
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim OpenDLG As New OpenFileDialog
OpenDLG.Title = "Open File"
OpenDLG.InitialDirectory = "C:\Documents and Settings\Jim Kabrich\My Documents\"
OpenDLG.RestoreDirectory = True
DialogResult = OpenDLG.ShowDialog
If DialogResult = Windows.Forms.DialogResult.OK Then
Dim objreader As New System.IO.StreamReader(OpenDLG.FileName)
TextBox6.Text = objreader.ReadToEnd
objreader.Close()
TextBox6.Text = OpenDLG.FileName.ToString()
ElseIf DialogResult = Windows.Forms.DialogResult.Cancel Then
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MsgBox("You Have Stopped Sending")
Me.Close()
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
The error says "sorry but the program has incountered an error and has to close" and it wants me to send an error report to microsoft.
If you want to try to open the file yourself here is the link to download:
Script(although I think it is working fine):
Imports System.Net.Mail
Public Class Form1
Dim y As Integer
Dim x As Integer
Dim z As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text.ToLower.Contains("@hotmail") Or TextBox1.Text.ToLower.Contains("@live") Or TextBox1.Text.ToLower.Contains("@msn") Then
x = 4
ElseIf TextBox1.Text.ToLower.Contains("@gmail") Then
x = 2
y = 2
z = 1
ElseIf TextBox1.Text.ToLower.Contains("@aol") Then
x = 2
y = 3
z = 1
ElseIf TextBox1.Text.ToLower.Contains("@yahoo") Then
x = 5
End If
'-----------------------------------------------------------------------------------------------------------------
'This is for Yahoo
If x = 5 Then
start1:
Dim oSmtp As New EASendMailObjLib.Mail
Form2.Label2.Text = Val(Form2.Label2.Text) + 1
oSmtp.LicenseCode = "TryIt"
oSmtp.FromAddr = TextBox1.Text
oSmtp.AddRecipientEx(TextBox3.Text, 0)
oSmtp.Subject = TextBox5.Text
oSmtp.BodyText = RichTextBox1.Text
oSmtp.ServerAddr = "smtp.mail.yahoo.com"
oSmtp.UserName = TextBox1.Text
oSmtp.Password = TextBox2.Text
oSmtp.ServerPort = 465
oSmtp.SSL_init()
If oSmtp.AddAttachment(TextBox6.Text) <> 0 Then
End If
If oSmtp.SendMail() = 0 Then
Form2.Show()
Else
MsgBox("ERROR" & oSmtp.GetLastErrDescription())
End If
'-----------------------------------------------------------------------------------------------------------------------------
'Multiple
If RadioButton1.Checked Then GoTo start1
ElseIf z = 1 Then
start2:
Dim oSmtp As New EASendMailObjLib.Mail
'--------------------------------------------------------------------------------------------------------------------
'This is for AOL and Gmail
Dim smtpServer As New SmtpClient
Dim mail As New MailMessage()
smtpServer.Credentials = New Net.NetworkCredential(TextBox4.Text, TextBox2.Text)
Form2.Label2.Text = Val(Form2.Label2.Text) + 1
If x = 1 Then smtpServer.Port = 465
If x = 2 Then smtpServer.Port = 587
If x = 3 Then smtpServer.Port = 995
If y = 1 Then smtpServer.Host = "smtp.live.com"
If y = 2 Then smtpServer.Host = "smtp.gmail.com"
If y = 3 Then smtpServer.Host = "smtp.aol.com"
If y = 4 Then smtpServer.Host = "smtp.mail.yahoo.com"
smtpServer.EnableSsl = True
mail = New MailMessage()
mail.From = New MailAddress(TextBox1.Text)
mail.To.Add(TextBox3.Text)
mail.Subject = TextBox5.Text
mail.Body = RichTextBox1.Text
If TextBox6.Text.Contains(Text) Then mail.Attachments.Add(New Attachment(TextBox6.Text, "Text/plain"))
smtpServer.Send(mail)
If RadioButton1.Checked = False or true Then Form2.Show()
'-----------------------------------------------------------------------------------------------------------------------------
'Multiple
If RadioButton1.Checked Then GoTo start2
'-----------------------------------------------------------------------------------------------------------------------
'This is for HotMail, Live, or MSN
ElseIf x = 4 Then
start3:
Dim oSmtp As New EASendMailObjLib.Mail
Form2.Label2.Text = Val(Form2.Label2.Text) + 1
oSmtp.LicenseCode = "TryIt"
oSmtp.FromAddr = TextBox1.Text
oSmtp.AddRecipientEx(TextBox3.Text, 0)
oSmtp.Subject = TextBox5.Text
oSmtp.BodyText = RichTextBox1.Text
oSmtp.ServerAddr = "smtp.live.com"
oSmtp.UserName = TextBox1.Text
oSmtp.Password = TextBox2.Text
oSmtp.ServerPort = 587
oSmtp.SSL_init()
If oSmtp.AddAttachment(TextBox6.Text) <> 0 Then
End If
If oSmtp.SendMail() = 0 Then
Form2.Show()
Else
MsgBox("ERROR" & oSmtp.GetLastErrDescription())
End If
End If
'-----------------------------------------------------------------------------------------------------------------------------
'Multiple
If RadioButton1.Checked Then GoTo start3
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim OpenDLG As New OpenFileDialog
OpenDLG.Title = "Open File"
OpenDLG.InitialDirectory = "C:\Documents and Settings\Jim Kabrich\My Documents\"
OpenDLG.RestoreDirectory = True
DialogResult = OpenDLG.ShowDialog
If DialogResult = Windows.Forms.DialogResult.OK Then
Dim objreader As New System.IO.StreamReader(OpenDLG.FileName)
TextBox6.Text = objreader.ReadToEnd
objreader.Close()
TextBox6.Text = OpenDLG.FileName.ToString()
ElseIf DialogResult = Windows.Forms.DialogResult.Cancel Then
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MsgBox("You Have Stopped Sending")
Me.Close()
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
The error says "sorry but the program has incountered an error and has to close" and it wants me to send an error report to microsoft.
Last edited by a moderator: