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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Different ways of handling emails. 1

Status
Not open for further replies.

poeijer

Programmer
May 29, 2002
69
NL
Hi All,

for each oMail in oInbox.Items

with oMail

tempsender=omail.sendername
tempsubject=omail.subject
temptime=omail.receivedtime

if temptime > date_email_last_time

etc........

the code above retrieves all mailitems received since a certain time. the problem that i have now is that
certain types of emails (e.g. confirmation emails) dont have a receivedtime in them. (they only got a send) also
the sendername doesn't seem to give a good result.

is there anyways how to filter out what the emailtype is?

i tried to find something on the internet but couldnt find anything. except for emailtype 1/2/3 which means new/reply/adminreply...

i hope i got everything clear. else just ask and i try to simplify it some more.

thanks in advance
 


dont have a receivedtime in them

Can you not filter on that? Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
i tried a if !empty(.receivedtime)

but still didnt work.
it just that it doesnt exist instead of being empty.. how do i capture that?
 
Try the following and see what you get
Code:
Local lnCount
oo=Createobject("outlook.application")
olNameSpace = oo.GetNameSpace("MAPI")
df=olNameSpace.GetDefaultFolder(6)
lnCount=df.items.Count
For i = 1 To lnCount
	cTime=''
	cTime = df.items(i).receivedtime
	If !Empty(cTime)
		Messagebox(Transform(cTime))
	Else
		Messagebox("You could skip this one")
	Endif
Next
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
thanks,, ill put it in right away..

do u have a method aswell to retreive the sendersemailaddress?

sender and sendername doesnt give me the exact email address back.

 
Your first idea doesnt work.

the error occurs when u receive a confirmation email (your message was read on blabla).

this type of email doesnt come with a .receivedtime property.

so i still need how to see what kind of email it is.

any other ideas maybe?
 
the error occurs when u receive a confirmation email (your message was read on blabla).

Then trap the error
Code:
ONERROR do emailerror
Local lnCount
oo=Createobject("outlook.application")
olNameSpace = oo.GetNameSpace("MAPI")
df=olNameSpace.GetDefaultFolder(6)
lnCount=df.items.Count
For i = 1 To lnCount
    cTime=''
    cTime = df.items(i).receivedtime
    If !Empty(cTime)
        Messagebox(Transform(cTime))
    Else
        Messagebox("You could skip this one")
    Endif
Next

PROCEDURE emailerror
  ** You can delete the record here
ENDPROC

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top