p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: Retrieve Email

Message #1 by "Phil Perks" <philp@w...> on Tue, 12 Sep 2000 14:23:32 +0100
-----Original Message-----

From: nata@m... [mailto:nata@m...]

Sent: 12 September 2000 12:03

To: support@w...

Subject: Retrieve Email

Dear Sir/Madam

I'm a new ASP programmer, and I have one of your book 

(ASP 2.0 Professional). 

In this time, I'm trying to build a web mail with MS 

Exchange Server 5.5 as my mail 

server. One of your script examples is about retrieving 

email (p. 659). I tried to edit 

it the way I want, but it didn"t work. Below is the 

script I wrote, please help me....

<% set objsession = createobject("CDONTS.session")

objSession.LogonSMTP "myName","myEmail"

set objinbox = objSession.inbox %>

message : <%=objInbox.Messages.Count%>


<table border="1" width="100%">


<td width="33%">From</td>

<td width="33%">Subject</td>

<td width="34%">Date</td>


<% if objInbox.Messages.Count = 0 then %>


<td width="100%" colspan=3>No Mail</td>


<% else

Set colMessages = objInbox.Messages

for iloop = 1 to colMessages.Count

set objMessage = colMessages(iloop) %>


<td width="33%"><%= objMessage.Sender%></td>

<td width="33%"><%= objMessage.Subject%></td>

<td width="34%"><%= objMessage.TimeSent%></td>


<% next

end if %>



<% If Not objSession Is Nothing Then

objSession.Logoff %>

Logged off; reset global variables <%

Else %>

No active session; cannot log off <%

End If

set objMessage = Nothing

set colMessages = Nothing

set objInbox = Nothing

Set objSession = Nothing %>

Sincerely yours,


  Return to Index