Hi, I have a pdf file in my webhost server. I want to send this file as attachment when visitor key in their email and click the send button.
the following is my code to send email, it works well without this line "mail.Attachments.Add(attachFile)"....
Dim attachfile As System.Net.Mail.Attachment
Dim SmtpServer As New Net.Mail.SmtpClient
Dim mail As New Net.Mail.MailMessage
SmtpServer.Host = "my smtp server"
SmtpServer.UseDefaultCredentials = False
SmtpServer.Credentials = New System.Net.NetworkCredential("my email", "my password")
mail.From = New Net.Mail.MailAddress("my email")
mail.To.Add("visitor email")
mail.Subject = "my email subject"
mail.IsBodyHtml = True
mail.Body = "my email body"
attachfile = New System.Net.Mail.Attachment("~/folder/file name")
mail.Attachments.Add(attachFile)
SmtpServer.Send(mail)
What should i do in order to be able to send the file in my server as attachment?
thanks in advance
garf