Switch to full style
ASP/ASP.net examples
Post a reply

read email inbox ASP

Fri Apr 08, 2011 9:18 pm

read content of email inbox using SMTP in asp
Code:
<html>

<%
 
  
    Dim objSession
, strEmail, strEmails, objInbox, intCurrentID
    
'create an instance of the CDONTS.Session object 
    objSession = Server.CreateObject("CDONTS.Session")
    '
use SMTP protocal to create session to email account .
    objSession.LogonSMTP("emailpassword", "youremail@domain.com")
    'get content of inbox.
    objInbox = objSession.Inbox
    '
get all messages in inbox folder. 
    strEmails 
= objInbox.Messages
    intCurrentID 
= Trim(Request.QueryString("MsgId"))
    Response.Write("Email inbox content:")
    If ("" = intCurrentID Or Not IsNumeric(intCurrentID)) Then
        
' loop on emails.
        '
 show list of emails.
        Dim intCount = 0
        For Each strEmail In strEmails
            intCount 
= intCount + 1
            
'create a link to email message.
            Response.Write("<a href=""")
            Response.Write(Request.ServerVariables("SCRIPT_NAME"))
            Response.Write("?MsgId=" & intCount & """>" & strEmail.Subject)
            Response.Write("</a>")
            Response.Write("<b> Sender :</b> " & strEmail.Author)
            Response.Write("<br>")
        Next
    Else
        strEmail = strEmails(intCurrentID)
        Response.Write("<b>Email Subject : </b>" & strEmail.Subject & "<br>")
        Response.Write("<b>Email Sender : </b>" & strEmail.Sender & "<br>")
        Response.Write("<b>Email Message : </b>" & strEmail.Text)
    End If
    '
close session. 
    objSession
.LogOff()
%>
</
html>
 




Post a reply
  Related Posts  to : read email inbox ASP
 Get job’s Alert In Your Inbox     -  
 Send an email in asp.net     -  
 Send email in asp     -  
 Java Email Class     -  
 Send Email from a PHP Script Example     -  
 validate email address in asp     -  
 Send email link example.     -  
 email through JAVA program     -  
 send email from ASP using CDOSYS     -  

Topic Tags

ASP Email