programming-examples/asp/More_Code_Snippets/View contents of your inbox.asp

32 lines
1.1 KiB
Plaintext
Raw Normal View History

2019-11-18 14:25:58 +01:00
<%
'create our variables
Dim cdoSession , strMessage , strMessages , objInbox , intMsgID
'create an instance of the CDONTS.Session object
Set cdoSession = Server.CreateObject("CDONTS.Session")
'this is your logon details
cdoSession.LogonSMTP "password" , "email@youraddress.com"
'open the inbox folder
Set objInbox = cdoSession.Inbox
'retrieve the messages collection
Set strMessages = objInbox.Messages
intMsgID = Trim(Request.QueryString("MsgId"))
If ("" = intMsgID Or Not IsNumeric (intMsgID)) Then
'display all the messages
For Each strMessage in strMessages
i = i + 1
Response.Write "<a href="""
Response.Write Request.ServerVariables("SCRIPT_NAME")
Response.Write "?MsgId=" & i & """>" & strMessage.Subject
Response.Write "</a>"
Response.Write " sent by : " & strMessage.Author
Response.Write "<br>"
Next
Else
Set strMessage = strMessages(intMsgID)
Response.Write "Subject : " & strMessage.Subject & "<br>"
Response.Write "Sender : " & strMessage.Sender & "<br>"
Response.Write "Message : " & strMessage.Text
End If
'log off from the session
cdoSession.LogOff
%>