<pre>Using mm As New MailMessage("info@ntrading.com", "aaa@gmail.com") filePath = Application.StartupPath + "\\PaySlip\\" + PaySlipName + ".pdf" mm.Subject = "test" mm.Body = "Checking" mm.Attachments.Add(New Attachment(filePath)) 'For Each filePath As String In openFileDialog1.FileNames ' If File.Exists(filePath) Then ' Dim fileName As String = Path.GetFileName(filePath) ' mm.Attachments.Add(New Attachment(filePath)) ' End If 'Next mm.IsBodyHtml = False Dim smtp As New SmtpClient() smtp.Host = "secure.webmail.com" smtp.EnableSsl = True Dim NetworkCred As New NetworkCredential("info@ntrading.com", "xxxxx123") smtp.UseDefaultCredentials = True smtp.Credentials = NetworkCred smtp.Port = 25 smtp.Send(mm) MessageBox.Show("Email sent.", "Message") End Using
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)