web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Creating attachment from MIME content

(0) ShareShare
ReportReport
Posted on by 635

Hi

When we add any attachments to an email the content of the file is stored in activitymimeattachment table in the database. I have a requirement where I have to fetch this data from the database and send these files as an attachment.

I am using the below code

MailMessage oMsg = new MailMessage();

System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType(mimetype);

Attachment att = Attachment.CreateAttachmentFromString(decodedText, ct);

att.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;

att.Name = filename;

att.ContentDisposition.DispositionType =
"attachment";

oMsg.Attachments.Add(att);

 However, the attachment I receive contains junk.

Any pointers on how to solve this problem?

Regards

Rahul

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
RichardM Profile Picture

RichardM 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans