webForumDet fria alternativet

JMail 4.3

ASP

1 svar · 138 visningar · startad av Robson

Medlem sedan dec. 2001200 inlägg
Frågan#1

Tjena,
Fick hjälp av en kille häromdan (OveRRidE), som gav mig denna kod.

<%
Do Until i = pop3.count
i = i + 1
Set msg = pop3.Messages.item(i)
%>
<tr>
<td><%=msg.FromName%></td>
<td><a href="read.asp?id=<%=i%>"><%=msg.Subject%></a></td>
<td><%=msg.From%></td>
<td><%=msg.Date%></td>
</tr>
<%
Loop
End If %>

Den skulle skrivas in "lite längre ner"??? Kan någon hjälpa mig var, och ifall något annat skall bort..?

Grejen é att jag vill ha upp samtliga mail - inte bara det senaste. Därför behövs en loop...men VAAAAAAAR!!!

<% @LANGUAGE=VBSCRIPT %>
<%

'*************************************************
'* *
'* Produced by Dimac *
'* *
'* More examples can be found at *
'* http://tech.dimac.net *
'* *
'* Support is available at our helpdesk *
'* http://support.dimac.net *
'* *
'* Our main website is located at *
'* http://www.dimac.net *
'* *
'*************************************************

Set pop3 = Server.CreateObject( "JMail.POP3" )

pop3.Connect "username", "password", "www.webbhotell.com"

Response.Write( "You have " & pop3.count & " mails in your mailbox!<br><br>" )

if pop3.count \> 0 then
Set msg = pop3.Messages.item(1) 	' Note the first element of this array is 1
									' since the POP3 server starts counting at 1
ReTo = ""
ReCC = ""

Set Recipients = msg.Recipients
separator = ", "



' We now need to get all the recipients,
' both normal and Carbon Copy (CC) recipients
' and store them in a variabel

For i = 0 To Recipients.Count - 1
	If i = Recipients.Count - 1 Then
		separator = ""
	End If

	Set re = Recipients.item(i)
	If re.ReType = 0 Then
		ReTo = ReTo & re.Name & " (\<a href=""mailto:"& re.EMail &"""\>" & re.EMail & "\</a\> )" & separator
	else
		ReCC = ReTo & re.Name & " (\<a href=""mailto:"& re.EMail &"""\>" & re.EMail & "\</a\> )" & separator
	End If
Next

' This function iterates through the Attachments object,
' and saves the attachment to the server's disk.
' It also returns a nicely formatted string with a
' link to the attachment.
Function getAttachments()
  	Set Attachments = msg.Attachments
  	separator = ", "

  	For i = 0 To Attachments.Count - 1
		If i = Attachments.Count - 1 Then
			separator = ""
	 	End If

	 	Set at = Attachments(i)
	 	at.SaveToFile( "c:\\EMail\\attachments\\" & at.Name )
	 	getAttachments = getAttachments & "\<a href=""/EMail/attachments/" & at.Name &"""\>" &\_
	 						at.Name & "(" & at.Size  & " bytes)" & "\</a\>" & separator
  	Next
End Function
  
%\>	
\<html\>
  \<body\>
	\<TABLE\>
	  \<tr\>
		\<td\>Subject\</td\>
		\<td\>\<%= msg.Subject %\>\</td\>
	  \</tr\>
	  \<tr\>
		\<td\>From\</td\>
		\<td\>\<%= msg.FromName %\>\</td\>
	  \</tr\>
	  \<tr\>
		\<td\>Recipients To\</td\>
		\<td\>\<%= ReTO %\>\</td\>
	  \</tr\>
	  \<tr\>
		\<td\>Recipients CC\</td\>
		\<td\>\<%= ReCC %\>\</td\>
	  \</tr\>
	  \<tr\>
		\<td\>Attachments\</td\>
		\<td\>\<%= getAttachments %\>\</td\>
	  \</tr\>
	  \<tr\>
		\<td\>Body\</td\>
		\<td\>\<pre\>\<%= msg.Body %\>\</pre\>\</td\>
	  \</tr\>		
	\</TABLE\>
  \</body\>
\</html\>
\<%

end if

pop3.Disconnect

%>

[Redigerat av Robson den 14 dec 2001]

Medlem sedan dec. 2001200 inlägg
#2

Grejen é att jag vill ha upp samtliga mail - inte bara det senaste. Därför behövs en loop...men VAAAAAAAR!!!

258 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e
126 ms — deklarationer (db)
0 ms — hämta statistik (cache)
129 ms — hämta tråd, inlägg och bilagor (db)
125 ms — ändringar (db)