
<%@ LANGUAGE="VBSCRIPT"%>
<%
Dim xpop, xmsg, xattach, i, mcount,
sBody
set xpop = Server.CreateObject("Pop3Express.DeliverMail")
' Àü¼Û »óŸ¦ È®ÀÎÇÒ ¶§ »ç¿ë
xpop.DisplayStatus = True
' ########################################
' µî·ÏµÈ »ç¿ëÀÚ °èÁ¤¼ö ¸¸Å ·çÇÁ¸¦ ¹Ýº¹ÇÑ´Ù.
' Pop3¼¹ö¿¡
¿¬°áÇÑ´Ù(¼¹öÀ̸§, ¾ÆÀ̵ð, ºñ¹Ð¹øÈ£)
If xpop.Connect("ServerName",
"Userid", "Password")
= FalseThen
response.write
xpop.ErrorString
Else
mcount
= xpop.FetchMsgCount()
'
Àüü ¸Þ½ÃÁö °¹¼ö¸¦ °¡Á®¿Â´Ù.
If
mcount < 0 Then
response.write
xpop.ErrorString
' ¸ÞÀÏÀ» ¹Þ¾Æ¿Ã ¶§ ¹ß»ýÇÑ ¿¡·¯¸Þ½ÃÁö
End
If
For
i = mcount To 1 Step -1
If
xpop.FetchMessage(i)
= False Then '
¸Þ½ÃÁö¸¦ °¡Á®¿Â´Ù.
response.write
xpop.ErrorString
End
if
'If
xpop.DeleteMessage(i)
= False Then '
¸Þ½ÃÁö¸¦ °¡Á®¿ÂÈÄ pop3¼¹öÀÇ ¸Þ½ÃÁö¸¦»èÁ¦
'
response.write xpop.ErrorString
'End
if
Next
End If
xpop.DisConnect
' ¼¹ö¿ÍÀÇ
¿¬°áÀ» ²÷´Â´Ù.
For
Each xmsg In xpop.Messages
'¸Þ½ÃÁö Ä÷º¼Ç¿¡¼
¸Þ½ÃÁö °´Ã¼¸¦ °¡Á®¿Â´Ù.
response.write
"From: " & xmsg.Size
& "<br>"
'¸Þ½ÃÁöÅ©±â(÷ºÎÆÄÀÏÆ÷ÇÔ)
response.write
"From: " & xmsg.From
& "<br>"
'º¸³½»ç¶÷ÀÇ
À̸§À̳ª À̸ÞÀÏÁÖ¼Ò
response.write
"FromEmail: " &
xmsg.FromAddress
& "<br>"
'º¸³½»ç¶÷ÀÇ
À̸ÞÀÏÁÖ¼Ò
response.write
"FromName: " &
xmsg.FromName
& "<br>"
'º¸³½»ç¶÷ÀÇ
À̸§
response.write
"To: " & xmsg.To
& "<br>"
'¸ÞÀÏÀ» ¹Þ´Â
»ç¶÷
response.write
"Cc: " & xmsg.Cc
& "<br>"
'ÂüÁ¶
response.write
"Bcc: " & xmsg.Bcc
& "<br>"
'¼ûÀº ÂüÁ¶
'º¸³½³¯Â¥(³â-¿ù-ÀÏ
½Ã:ºÐ:ÃÊ)
response.write
"SendDate: " &
xmsg.SendDate("%Y-%m-%d
%H:%M:%S") &
"<br>"
'¹ÞÀº
³¯Â¥(³â/¿ù/ÀÏ ½Ã:ºÐ:ÃÊ)
response.write
"ReceiveDate: " &
xmsg.ReceiveDate("%Y/%m/%d
%H:%M:%S") & "<br>"
response.write
"Charset: " &
xmsg.Charset &
"<br>" 'ij¸¯ÅͼÂ(¹®ÀÚ¿Çü½Ä)
response.write
"EncodeType: " &
xmsg.EncodeType
& "<br>"
'ÀÎÄÚµùŸÀÔ
response.write
"Priority: " &
xmsg.Priority
& "<br>"
'¸ÞÀÏÀÇ Á߿䵵
response.write
"Subject: " &
xmsg.Subject &
"<br>" '¸ÞÀÏÀÇ
Á¦¸ñ
'
÷ºÎÆÄÀÏÀÌ ÀÖÀ¸¸é ÷ºÎ ÆÄÀÏÀ» ÀúÀåÇÑ´Ù.(÷ºÎÆÄÀϰú
º»¹®¿¡ Æ÷ÇÔµÈ ÆÄÀÏ·Î ±¸ºÐµÈ´Ù)
sBody
= xmsg.Html
For
Each xattach In xmsg.Attachments
if
xattach.ContentsID
= "" then '÷ºÎ
ÆÄÀÏ
xattach.SaveFile
"./file/" & xattach.FileName
else
' º»¹®¿¡
Æ÷ÇÔµÈ ÆÄÀÏ(ÄÁÅÙÃ÷ ¾ÆÀ̵𰡠ÀÖÀ¸¸é º»¹®¿¡ Æ÷ÇÔµÈ
ÆÄÀÏ)
'º»¹®¿¡
Æ÷ÇÔµÈ ÆÄÀÏÀº À¥¿¡¼ º¸¿©ÁÙ ¼ö ÀÖ´Â °æ·Î¿¡ ÀúÀåÇÑ´Ù.
xattach.SaveFile
"./body_file/" &
xattach.FileName
'º»¹®¿¡
ÄÁÅÙÃ÷ ¾ÆÀ̵𸦠À¥ °æ·Î·Î ¹Ù²Û´Ù.
sBody
= replace(sBody,"cid:"
& xattach.ContentsID,
"./body_file/" &
xattach.FileName)
sBody
= replace(sBody,xattach.ContentsID,
"./body_file/" &
xattach.FileName)
end
if
Next
If
Len(xmsg.Html) > 0 Then
response.write
"Html: " & sBody
& "<br>"
'¸ÞÀÏÀÇ Html·Î
µÈ º»¹®
Else
response.write
"Text: " & xmsg.Text
& "<br>"
'¸ÞÀÏÀÇ Text·Î
µÈ º»¹®
End
If
Next
' ########################################
' ·çÇÁ ³¡
set xpop = nothing
%>
|