Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading email from ASP page

Status
Not open for further replies.

goofy

Programmer
Feb 3, 2001
30
0
0
US
Hi,

I want to read an email and display in an ASP page, can anybody help me out with this.

Thanks in advance
 
You have to use MApi functions. But i cant help you more.

________
George, M
 
you could try something similar to this:
Code:
Dim fso, myfile, myfile2, strMessage, strMessage2
strMessage = ""
strMessage2 = ""
Set fso = CreateObject("scripting.FileSystemObject")
Set myfile = fso.CreateTextFile("C:\ON.txt", True)
Set myfile2 = fso.CreateTextFile("C:\OFF.txt", True)
Dim today
today = (Day(Date) & "-" & MonthName(Month(Date), True) & "-" & Right(Year(Date), 2))
        
Set objApp = GetObject(, "Outlook.Application")        '#### Find existing instance of Outlook
If Err Then
'  WScript.Quit()                    '#### If Outlook isn't running, quit the script
 Set objApp = CreateObject("Outlook.Application")    '#### uncomment this & comment out above line to get data even if Outlook isnt running
End If
Set objOutlook = objApp.GetNameSpace("MAPI")

Set objInboxItems = objOutlook.GetDefaultFolder(6).Items     '#### Get inbox folder items

For Each aItem In objInboxItems
   If aItem.Subject = "ON SITE MOVEMENT REPORT FOR "  & today & "" Then
'     strMessage = aItem.Message 'or .Message or .body .text
strMessage = strMessage & vbCr & "NEXT ONE" & vbCr & aItem.body
     Else
'     If aItem.Subject = "**DIALOG** TAPE OFF SITE MOVEMENT REPORT FOR " & today & "" Then
     '     strMessage2 = aItem.Message     'or .Message or .body .text
strMessage2 = strMessage2 & vbCr & "NEXT ONE" & vbCr & aItem.body
     End If
   End If

Next
myfile.Writeline (strMessage)
myfile2.Writeline (strMessage2)
myfile.Close
myfile2.Close

'set objects to nothing
Set objApp = Nothing
Set objOutlook = Nothing
Set objInboxItems = Nothing
Set fso = Nothing
Set myfile = Nothing
Set myfile2 = Nothing

it was originally for vbscript running in excel, but I think it should work, or at least get you started.
 
This is great!!
Thank you very much!!!!
Lots of light at the end of the tunnel!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top