Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
|
Code to Download an Email Attachment
ASP code to return an email attachment. <% ' This ASP will return an email's Nth attachment. ' The 1st attachment is at index 0. attachIdx = 0 ' This is the filename of the .eml on the ASP server. emlFilename = "testEmail.eml" ' An email can be loaded into an email object from memory ' by calling SetFromMimeText, or from a file by calling ' LoadEml. ' Create a MailMan object first for the purpose ' of unlocking the component. (Only one is necessary) set mailman = Server.CreateObject("Chilkat.MailMan2") mailman.UnlockComponent "anything for 30-day trial" set email = Server.CreateObject("Chilkat.Email2") ' Load an email containing attachments. ' success = email.LoadEml(Server.MapPath(emlFilename)) If (success <> 1) Then Response.Write email.LastErrorText & "<br>" End If ' Response.ContentType = email.GetAttachmentContentType(attachIdx) Response.BinaryWrite email.GetAttachmentData(attachIdx) %> |
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.