Cor3Quad Posted January 17, 2014 Report Share Posted January 17, 2014 Vreau ca, ce se scrie in Textbox1 si textbox2 sa se trimita pe un cont de gmail.Am codul :Imports System.Net.MailPublic Class Form1 Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged If CheckBox2.Checked = True Then CheckBox1.Checked = False End If End Sub Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged If CheckBox1.Checked = True Then CheckBox2.Checked = False End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "" Then MsgBox("Enter a Password!") Else If TextBox2.Text = "" Then MsgBox("Enter Email!") Else Dim SmtpServer As New SmtpClient() Dim mail As New MailMessage() SmtpServer.Credentials = New Net.NetworkCredential("email", "mypassword") SmtpServer.EnableSsl = True SmtpServer.Port = 465 SmtpServer.Host = "smtp.gmail.com" SmtpServer.EnableSsl = True mail = New MailMessage() mail.From = New MailAddress("aiciprimesc@gmail.com") mail.To.Add("aiciprimesc@gmail.com") mail.Subject = TextBox1.Text mail.Body = TextBox2.Text Try SmtpServer.Send(mail) Catch ex As Exception MsgBox("done") End Try End If End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End SubEnd ClassSe blocheaza cand dau send si :A first chance exception of type 'System.Net.Mail.SmtpException' occurred in System.dll Quote Link to comment Share on other sites More sharing options...
Maximus Posted January 17, 2014 Report Share Posted January 17, 2014 Catch ex As Exception MsgBox(ex.tostring) End Tryca sa vezi unde e problema, desi eu cred ca e de la port incearca fara ssl Quote Link to comment Share on other sites More sharing options...
Cor3Quad Posted January 17, 2014 Author Report Share Posted January 17, 2014 (edited) SmtpServer.EnableSsl = FalseCatch ex As Exception When MsgBox(ex.ToString())+Exception Mesages DisabledAcceeasi problema.Am rezolvat pana la urma :Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "" Then MsgBox("Enter a Password!") Else If TextBox2.Text = "" Then MsgBox("Enter Email!") Else End If End If Try Dim SmtpServer As New SmtpClient SmtpServer.EnableSsl = True Dim mail As New MailMessage SmtpServer.Credentials = New Net.NetworkCredential("mailumeu@gmail.com", "PAROLA-REALA") SmtpServer.Port = 587 SmtpServer.Host = "smtp.gmail.com" mail = New MailMessage mail.From = New MailAddress("mailumeu@gmail.com") mail.To.Add("mailumeu@gmail.com") mail.Subject = TextBox2.Text mail.Body = TextBox1.Text SmtpServer.Send(mail) MsgBox("Done!") Catch ex As Exception End Try End Sub Edited January 17, 2014 by Cor3Quad Quote Link to comment Share on other sites More sharing options...