---
title: "JMail"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/103092-jmail"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "LR^evil.sid"
published: "2004-05-06T09:11:29.000Z"
updated: "2004-06-07T13:52:28.000Z"
replies: 13
views: 325
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/103092-jmail"
---

# JMail

## #1 — LR^evil.sid, 2004-05-06T09:11Z

Har använt mig av JMails kodtutorial men får det inte att fungera:

```
Set Pop3 = Server.CreateObject("JMail.Pop3")
Pop3.Connect username, password, mailserver, 110
With Response
	.Write Pop3.Count & " "
	If Pop3.Count > 0 Then
		For i = 1 To Pop3.Count
			Set Msg = Pop3.Messages.Item(i)
			Set Recipients = Msg.Recipients
			For n = 0 To Recipients.Count - 1
				If n = Recipients.Count - 1 Then
					Separator = "; "
				End If
				Set re = Recipitants.Item(n)
				If re.ReType = 0 Then
					ReTo = ReTo & re.Name & "&nbsp;" & re.EMail & """>" & re.EMail & Separator
				Else
					ReCC = ReTo & re.Name & "&nbsp;" & re.EMail & """>" & re.EMail & Separator
				End If
			Next
		Next
		.Write "From: " & Msg.FromName & "<br>"
		.Write "Subj: " & Msg.Subject & "<br>"
		.Write "Rec To: " & ReTo & "<br>"
		.Write "Rec CC: " & ReCC & "<br>"
		.Write "<hr>"
		.Write Msg.Body
		Msg.Disconnect
	Else
		.Write "None there is..."
	End If
End With
```

Har skickat ett mail till mig själv men Pop3.Count säger fortfarande att jag inte har några mail. Vad tror ni är fel?

Permalänk: https://www.webforum.nu/p/103092

## #2 — CHEETAHiAM, 2004-05-08T07:43Z

någon som vet denna? \*undrar också!\* :)

Permalänk: https://www.webforum.nu/p/1343069

## #3 — CHEETAHiAM, 2004-05-10T20:29Z

bump

Permalänk: https://www.webforum.nu/p/1344135

## #4 — Jymdis, 2004-05-10T20:43Z

Har du verifierat så att där verkligen är ett mejl på pop3 kontot?

Permalänk: https://www.webforum.nu/p/1344141

## #5 — LR^evil.sid, 2004-05-11T10:11Z

Jag har ju läst det mail jag skickat till mig själv så ja, det finns ett mail där.

Permalänk: https://www.webforum.nu/p/1344316

## #6 — Jymdis, 2004-05-11T10:15Z

testa med:

```
This example pops the first email in a given POP3 mailbox and displays it on the webpage together with it's attachments, which in turn are saved to the servers disc.The use of this example is of course limited, however, it shows how you easily can connect to a POP3 server and retrieve emails from a mailbox and also handles attachments in a clever manner. 

 
   POP3simple.asp

<% @LANGUAGE=VBSCRIPT %>
<% 

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

pop3.Connect "username", "password", "mail.mydomain.com"

Response.Write( "You have " & pop3.count & " emails 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 & "&nbsp;(" & re.EMail & ")" & separator
  else
    ReCC = ReTo & re.Name & "&nbsp;(" & re.EMail & ")" & 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:\attachments\" & at.Name )
  getAttachments = getAttachments & "<a href=""/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

%>
```

istället då?

Permalänk: https://www.webforum.nu/p/1344317

## #7 — LR^evil.sid, 2004-05-11T10:33Z

Skickade ett mail. Ser att det kommit fram. Testkörde koden.

"You have 0 emails in your mailbox!"

Permalänk: https://www.webforum.nu/p/1344326

## #8 — Jymdis, 2004-05-11T10:35Z

Du är 100% säker på att du connectar till rätt mailbox?

Permalänk: https://www.webforum.nu/p/1344329

## #9 — LR^evil.sid, 2004-05-11T10:40Z

POP3/IMAP4-server är korrekt. Mailadressen har jag själv laggt till så den vet jag är korrekt, lika så lösenord. Allt stämmer.

Permalänk: https://www.webforum.nu/p/1344331

## #10 — LR^evil.sid, 2004-05-11T10:43Z

hmmm

Det här var intressant... när jag loggar in via webben på kontot så finns där inga mail. men jag har gjort samma inställning i outlook och där ser jag klart och tydligt mina tre mail jag skickat till mig...

Permalänk: https://www.webforum.nu/p/1344334

## #11 — LR^evil.sid, 2004-05-11T10:50Z

ok, när jag tog bort mitt konto i outlook så fungerar det. antar att jag klipper ut mailen så de inte finns kvar på servern istället för att kopiera. : /

Permalänk: https://www.webforum.nu/p/1344339

## #12 — Jymdis, 2004-05-11T10:54Z

Okej, då var det som vi misstänkte då, inga mejl egentligen :)
Uppenbarligen kunde den connecta till server och ett konto för annars hade du fått ett felmeddelande.

Permalänk: https://www.webforum.nu/p/1344344

## #13 — Meng, 2004-06-07T13:49Z

Det är ju en inställning i Outlook och outlook express. Nu kör jag mot Exchange server med Outlook men jag kan visa från Outlook Express med POP3 inställningar:

Bilagor:

- [mail.gif](https://www.webforum.nu/a/3706.gif)

Permalänk: https://www.webforum.nu/p/1362426

## #14 — Jymdis, 2004-06-07T13:52Z

Meng:
mm fast alla email servrar går inte med på det har jag märkt.

Permalänk: https://www.webforum.nu/p/1362430

---

Tråden på webben: https://www.webforum.nu/amne/asp/103092-jmail
