i am trying to send PDF file using itextsharp , the email sends fine but with out the pdf attachment
can some tell me what is wrong with my code ?
here is my code :
Dim pdfFile As MemoryStream = New MemoryStream()
Dim d As Document = New Document(PageSize.A4, 60, 60, 40, 40)
Dim w As PdfWriter = PdfWriter.GetInstance(d, pdfFile)
w.Open()
w.Add(New Paragraph("do foo something "))
Dim message As New MailMessage()
message.From = New MailAddress("******")
message.To.Add(New MailAddress("***************"))
message.Subject = "new image "
message.Body = "this is the apak chart img"
Dim data As New Attachment(pdfFile, New System.Net.Mime.ContentType("application/pdf"))
message.Attachments.Add(data)
Dim client As New SmtpClient()
client.Host = "smtp.gmail.com"
client.Credentials = New NetworkCredential("*****", "*******")
client.EnableSsl = True
client.Port = 587
client.Send(message)