CreativeHost
empresa
Empresa opinião de clientes Opinião contrato Contrato política de uso Política webmail Webmail painel de controle Painel suporte Suporte
página inicial página inicial planos de hospedagem planos de hospedagem de sites serviços em internet serviços em internet contato hospedagem de sites contato hospedagem de sites assine hospedagem de sites assine hospedagem de sites

Hospedagem
Assine: (11) 3721-0210

Clique aqui e assine já!

Faça a análise
ONLINE DE VÍRUS

* Não precisa de instalação
Panda ActiveScan
Início
Componentes ASP - ASP POP3

O componente ASPPOP3 permite o recebimento de e-mails utilizando o protocolo POP3. Esse componente é geralmente utilizado no desenvolvimento de WebMail. Não é necessário nenhuma alteração no arquivo que segue abaixo. Em nosso exemplo, utilizamos o nome webmail.asp.


Código ASP:

webmail.asp

<!-- Início ASP --->

<html>
<head><title>CreativeHost - Exemplo AspPOP</title><head>
<body bgcolor="white">
<H1 align="center">CreativeHost - Exemplo AspPOP</H1>
<blockquote>
<%
On Error resume next
function Subst (strValue, strOldValue, strNewValue)
intLoc = InStr(strValue, strOldValue)
While intLoc > 0
if intLoc > 1 then
if intLoc = Len(strValue) then
strValue = Left(strValue, intLoc-1) & strNewValue
else
strValue = Left(strValue, intLoc -1) & strNewValue & Right(strValue, Len(strValue)-(intLoc-Len(strOldValue)+1))
end if
else
strValue = strNewValue & Right(strValue, Len(strValue)-1)
end if
intLoc = InStr(strValue, strOldValue)
Wend
Subst = strValue
end function
function FixUpItems (strItem)
if strItem <> "" then
strItem = Subst(strItem, "<", "&lt;")
strItem = Subst(strItem, ">", "&gt;")
FixUpItems = strItem
else
FixUpItems = "<br>"
end if
end function
sub ShowPopForm (strHostName, strUser, strPassword)
Response.Write "<table border=0>"
Response.Write "<form action=""webmail.asp"" method=post>"
Response.Write "<tr><td>Informe seu Servidor POP3:<td><input type=text size=45 name=host value=""" & strHostName & """>"
Response.Write "<tr><td>Informe seu endereço de e-mail:<td><input type=text size=45 name=uid value=""" & strUser & """>"
Response.Write "<tr><td>Informe sua senha:<td><input type=password size=45 name=pwd value=""" & strPassword & """>"
Response.Write "<input type=""Submit"">"
Response.Write "</form>"
Response.Write "</table>"
end sub
sub ShowMessageList (strHost, strUid, strPwd)
Response.Write "<h2>Mensagens no Servidor: " & strHost & "</h2>"
Set Mailer = Server.CreateObject("POP3svg.Mailer")
Mailer.RemoteHost = strHost
Mailer.UserName = strUid
Mailer.Password = strPwd
if Mailer.GetPopHeaders then
Response.Write "<table border=1 width=""90%"">"
Response.Write "<tr>"
Response.Write "<td><b>" & "Msg #" & "<b></td>"
Response.Write "<td><b>" & "Assunto" & "<b></td>"
Response.Write "<td><b>" & "Data" & "<b></td>"
Response.Write "<td><b>" & "De" & "<b></td>"
Response.Write "<td><b>" & "Tamanho" & "<b></td>"
Response.Write "<td><b>" & "Status" & "<b></td>"
Response.Write "<td><b>" & "Apagar" & "<b></td>"
Response.Write "</tr>"
varArray = Mailer.MessageInfo
if VarType(varArray) <> vbNull And IsEmpty(varArray) <> True then
ArrayLimit = UBound(varArray)
For I = 0 to ArrayLimit
Response.Write "<tr>"
strMsgNo = Trim(varArray(I)(0))
Randomize
intRndNo = Int(500 * Rnd)
Response.Write "<td align=right>" & strMsgNo & "</td>"
strSubject = varArray(I)(1)
if strSubject = "" then strSubject = "(No Subject)"
Response.Write "<td align=left>" & FixUpItems (strSubject) & "</td>"
Response.Write "<td align=left>" & varArray(I)(2) & "</td>"
Response.Write "<td align=left>" & FixUpItems (varArray(I)(3)) & "</td>"
Response.Write "<td align=left>" & varArray(I)(7) & "</td>"
strStatus = varArray(I)(8)
if (strStatus = "") then
strStatus = "<b>Unread</b>"
else
strStatus = varArray(I)(8)
end if
Response.Write "<td align=left>" & strStatus & "</td>"
Response.Write "<td align=left>" & "<a href=webmail.asp?deletemsg=" & strMsgNo & "&rndno=" & intRndNo & ">Apagar</a></td>"
Response.Write "</tr>" & Chr(10) & Chr(13)
Next
else
Response.Write "<tr><td colspan=10 align=center><b>Não há mensagens no servidor.</b></tr>"
end if
Response.Write "</table>"
else
Response.Write "<p>Falha na Conexão. Verifique seu servidor POP3, nome de usuário e senha."
end if
Response.Write "</blockquote>"
end sub
sub DeleteMessage (strHost, strUid, strPwd, strMsgNo)
Response.Write "<b>Excluindo mensagem #" & strMsgNo & " do Servidor.</b><p>"
Set Mailer = Server.CreateObject("POP3svg.Mailer")
Mailer.RemoteHost = strHost
Mailer.UserName = strUid
Mailer.Password = strPwd
Mailer.OpenPop3
Mailer.Delete strMsgNo
Mailer.ClosePop3
ShowMessageList strHost, strUid, strPwd
end sub
sub SavePOPVars
Session("host") = Request.Form("host")
Session("uid") = Request.Form("uid")
Session("pwd") = Request.Form("pwd")
end sub
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
SavePOPVars
end if
strHost = Session("host")
strUid = Session("uid")
strPwd = Session("pwd")
strMsgNo = Request.QueryString("msgno")
strDeleteNo = Request.QueryString("deletemsg")
if (strUid = "") or (strPwd = "") or (strHost = "") then
ShowPopForm strHost, strUid, strPwd
else
if (strMsgNo <> "") then
ShowMessage strHost, strUid, strPwd, strMsgNo
else
if (strDeleteNo <> "") then
DeleteMessage strHost, strUid, strPwd, strDeleteNo
else
ShowMessageList strHost, strUid, strPwd
end if
end if
end if
%>
</body>
</html>

<!-- Fim ASP --->

 
©2002-2008 - CreativeHost Networks Ltda Me - Hospedagem de sites em boas mãos