I'm trying to send an attachment using smtp. I have been successful in sending emails without attachments but every thing I have tried when using the MailAttachment object results in Invalid Attachment.
I know the attachment exists and that I have access to the file. I have tried both MailEncoding's but with the same result.
Any ideas?
Code:MailMessage mailMessage = new MailMessage(); mailMessage.Attachments.Add( new MailAttachment(temp, MailEncoding.UUEncode)); mailMessage.From = txtTo.Text mailMessage.To = txtEmail.Text; mailMessage.Subject = "Attachment" mailMessage.Body = "Attachment Test"; SmtpMail.Server = "localhost"; SmtpMail.Send(mailMessage);


Reply With Quote