Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

sending email with attachment corrupts entire email

$
0
0


I'm attempting to send an email in a console application.  If i inclue an attachment, the entire email is corrupt.  The attachment is embeded in the body of the email. In addition, the sender, send to and subject are all blank. The email is received but entirely corrupt.

The attachment is a jpeg.  I added content type "Image/jpeg" to the attachment with no joy. If i remove the attachment portion, the email is sent just fine.  All fields are populated correctly.  See attached email image.

 System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(pms.MailUID, pms.MailPass);
            SmtpClient client = new SmtpClient(pms.MailServer);
            client.Host = pms.MailServer;
            client.UseDefaultCredentials = false;
            client.Credentials = SMTPUserInfo;
            if (EmailAttachment.Trim().HasValue()){
                Attachment at = new System.Net.Mail.Attachment(System.IO.Path.GetFullPath(EmailAttachment));
                message.Attachments.Add(at);
            }

            try{
                client.Send(message);
            }


Thanks in advance.


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>