Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component


Index of Chilkat Blog Posts

November 16, 2005

Saving Email to Database

Question:

Suppose I want to store an email, with attachment in an SQL database, is that feasible and/or practical using Chilkat.net? If so, how would you suggest I do that? I wasn’t sure if the GetXML or getMIME method would work better (or at all). Thanks in advance.

Answer:

If you want to save the entire email (attachments and all) to a database, I would recommend calling email.GetMime to get the complete MIME source of the email and then saving it in an appropriate database field. The DB field should be a "text" field capable of holding any amount of text. If you want to save only the attachments, I would write code to get the binary attachment data using email.GetAttachmentData and save it to a DB field, which should be of a type capable of any-size binary data such as images.


Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.