Hi,
I'm using the below code to send mail with attachment, its working fine except that my PC freezes for 10 seconds whenever I run this code, is there a way to avoid system lag?,
I tried to lower the process priority by using "Process.GetCurrentProcess.PriorityClass = ProcessPriorityClass.Idle" but it didn't help.
Any suggestions please?
Code:Dim MyMailMessage As New MailMessage Try MyMailMessage.From = New MailAddress("[email protected]") MyMailMessage.To.Add("[email protected]") MyMailMessage.Subject = "Mail Subject...." Dim attch As New Mail.Attachment("C:\Picture.jpeg") MyMailMessage.Attachments.Add(attch) MyMailMessage.Body = "Message text...." Dim SMTP As New SmtpClient("smtp.gmail.com") SMTP.Port = 587 SMTP.EnableSsl = True SMTP.Credentials = New System.Net.NetworkCredential("[email protected]", "myemailpassword") SMTP.Send(MyMailMessage) Catch ex As Exception End Try




Reply With Quote