M
MoFo22
Im working on an asp page that retrieves a message(s) from my inbox. The
problem im having is getting to the attachment object. My final goal
is to save the email into a database along with the attachment(s).
Here is the code I have so far.
Thanks.
<%@ LANGUAGE=VBScript %>
<% Option Explicit %>
<HTML>
<BODY>
<P>
<%
Dim objMessage
Dim colRecips
Dim objRecip
Dim objFolder
Dim objSession
Dim intIndex
Dim strFolderID
Dim strFolderName
Dim strTo
Dim strCC
Dim strImportance
Dim collAttachments
Dim iAttachCollIndex
Dim objAttach
Dim objAttachname
Dim objAttachpath
Dim objMsg
Dim Item
Dim brad
strTo = " "
strCC = " "
'Get the information about the message to display
strFolderName = Request.QueryString("Folder")
strFolderID = Session(strFolderName)
intIndex = Cint(Request.QueryString("MsgID"))
'Retrieve the selected message object
Set objSession = Session("CurSession")
Set objFolder = objSession.GetFolder(strFolderID)
Set objMessage = objFolder.Messages(CInt(intIndex))
'set objAttachment = objSession.Attachment(CInt(intIndex))
Set collAttachments = objMessage.Attachments
If collAttachments.count < 1 then
response.write "Unable to set Attachments collection"
Else
response.write "Attachments count for this message: " &
collAttachments.Count
End If
'Process the recipients
Set colRecips = objMessage.Recipients
strImportance = "Normal"
%>
<BR>
<Table border=0 cellspacing=1 cellpadding=1 width="400, 400, 400, *">
<TR>
<td>
<input ID=btnReply NAME=btnReply Type=Button Value="Reply" >
</td>
<td>
<input id=btnReplyAll Name=btnReplyAll Type=Button Value="Replay
All">
</td>
<td>
<input id=btnForward name=btnFormward type=Button Value="Forward">
</td>
</tr>
</table>
<BR>
<table border=0 cellpadding=1 cellspacing=1 width="75%">
<TR>
<td><strong>From:</strong></td>
<td><label><% =objMessage.Sender %></label></td>
</tr>
<tr>
<td><strong>Subject:</strong></td>
<td><label><% =objMessage.Subject %></label></td>
</tr>
<tr>
<td><strong>Importance:</strong></td>
<td><label><% =strImportance %></label></td>
</tr>
<tr>
<td><strong>Message:</strong></td>
<td><textarea ID=textarea1 name=textarea1 style="Height: 390px;
width: 547px"><% =objMessage.Text %></textarea></td>
<td><label><% =strImportance %></label></td>
</tr>
<tr>
<td><strong>Attachment:</strong></td>
<td><label><% =objAttach %></label></td>
</tr>
</table>
</p>
</body>
</html>
<script id=clientEventHandlersVBS Language=VBScript>
Sub btnReply_onClick()
strWhat = "Reply"
end Sub
Sub btnReplyAll_onClick()
strWhat = "ReplyAll"
end Sub
Sub btnForward_onClick()
strWhat = "Forward"
End sub
</script>
problem im having is getting to the attachment object. My final goal
is to save the email into a database along with the attachment(s).
Here is the code I have so far.
Thanks.
<%@ LANGUAGE=VBScript %>
<% Option Explicit %>
<HTML>
<BODY>
<P>
<%
Dim objMessage
Dim colRecips
Dim objRecip
Dim objFolder
Dim objSession
Dim intIndex
Dim strFolderID
Dim strFolderName
Dim strTo
Dim strCC
Dim strImportance
Dim collAttachments
Dim iAttachCollIndex
Dim objAttach
Dim objAttachname
Dim objAttachpath
Dim objMsg
Dim Item
Dim brad
strTo = " "
strCC = " "
'Get the information about the message to display
strFolderName = Request.QueryString("Folder")
strFolderID = Session(strFolderName)
intIndex = Cint(Request.QueryString("MsgID"))
'Retrieve the selected message object
Set objSession = Session("CurSession")
Set objFolder = objSession.GetFolder(strFolderID)
Set objMessage = objFolder.Messages(CInt(intIndex))
'set objAttachment = objSession.Attachment(CInt(intIndex))
Set collAttachments = objMessage.Attachments
If collAttachments.count < 1 then
response.write "Unable to set Attachments collection"
Else
response.write "Attachments count for this message: " &
collAttachments.Count
End If
'Process the recipients
Set colRecips = objMessage.Recipients
strImportance = "Normal"
%>
<BR>
<Table border=0 cellspacing=1 cellpadding=1 width="400, 400, 400, *">
<TR>
<td>
<input ID=btnReply NAME=btnReply Type=Button Value="Reply" >
</td>
<td>
<input id=btnReplyAll Name=btnReplyAll Type=Button Value="Replay
All">
</td>
<td>
<input id=btnForward name=btnFormward type=Button Value="Forward">
</td>
</tr>
</table>
<BR>
<table border=0 cellpadding=1 cellspacing=1 width="75%">
<TR>
<td><strong>From:</strong></td>
<td><label><% =objMessage.Sender %></label></td>
</tr>
<tr>
<td><strong>Subject:</strong></td>
<td><label><% =objMessage.Subject %></label></td>
</tr>
<tr>
<td><strong>Importance:</strong></td>
<td><label><% =strImportance %></label></td>
</tr>
<tr>
<td><strong>Message:</strong></td>
<td><textarea ID=textarea1 name=textarea1 style="Height: 390px;
width: 547px"><% =objMessage.Text %></textarea></td>
<td><label><% =strImportance %></label></td>
</tr>
<tr>
<td><strong>Attachment:</strong></td>
<td><label><% =objAttach %></label></td>
</tr>
</table>
</p>
</body>
</html>
<script id=clientEventHandlersVBS Language=VBScript>
Sub btnReply_onClick()
strWhat = "Reply"
end Sub
Sub btnReplyAll_onClick()
strWhat = "ReplyAll"
end Sub
Sub btnForward_onClick()
strWhat = "Forward"
End sub
</script>