Mail headers

HI,

Please explain while using get outlook mail message to get the-- date of emails they are using mail.Headers(“Date”) .

What is the purpose of using Header?
PLease give few other examples of using Headers keyword

1 Like

Buddy @

In mails usually we will be two segments, header and body, where header consists of date when mail was received, who sent us, what was the subject in the mail that was sent, who are the other cc recipients, like that and those information can be obtained and are defined in header method in dot net…so to get those details we need to call header methods, where there are many similar methods with different input arguments, like polymorphism, and each one will give us different value as output, similar the same to get body of the mail we use mailemessage(index).body, and there are many other methods each giving different outputs that we want, simply to check them what are the inherited methods in header, just define mailmessage datatype variable and type like mailmessagevariable.header.
This will list all the results that a header method can give you…
Cheers buddy @vikumars1

2 Likes

Hi Palaniyappan ,

Thanks for the explanation .image

Nam am trying to read email with the subject “legacy” and also with today’s date alone .

What needs to be given inside the filter property(highlighted in yellow)

Hey @vikumars1

Try this: -

"@SQL=" + "" + "urn:schemas:httpmail:subject" + "" + " like '%legacy%'AND %today("urn:schemas:httpmail:datereceived")%"

Regards…!!
Aksh

Thats great
Try to mention like this buddy @vikumars1
"[Subject]=‘legacy’ and [ReceivedDate] = ’ " + now.ToString(“MM/dd/yyyy”) + " ’ ] "

Hi ,

How to get mails for today’s date starting from 0th hour onwards till now

same buddy but like this
“[ReceivedTime] >= ’ " + now.ToString(“MM/dd/yyyy HH:mm”) + " ']”
where HH is for 24 hrs and hh is for 12 hrs

mentionlike
“[ReceivedTime] >= ’ " + now.ToString(“05/15/2019 00:00”) + " ']”

Cheers @vikumars1

HI Palani ,

Sorry , i need mails from today’s date 0th hour to till now??
Don’t we have any Truncate like function here??

this would work buddy @vikumars1
“[ReceivedTime] >= ’ " + now.ToString(“05/15/2019 00:00”) + " ']”

HI Palani ,

If i execute it daily means, i need to change the date in Tostring part right??.
Is there any other alternatives to avoid hard coded dates?

HI Palani ,

If i execute it daily means, i need to change the date in Tostring part right??.
Is there any other alternatives to avoid hard coded dates?

1 Like

This alone buddy @vikumars1

“[ReceivedTime] >= ’ " + now.ToString("MM/dd/yyyy HH:mm”) + " ']”

1 Like

HI ,

I’m using for loop to get through all mail and downloading the attachments.

Now my challenge is i need to use if condition and check attachments exists in the mail ,after that only need to download it .

Could you please help me in that??

use if conditions like this buddy @vikumars1
Item.Attachments.Any

Hi Palani ,

Now i’m having list of excel sheets as below :
Legacy_Shipment_Matching_TE_1505201907
Legacy_Shipment_Matching_TE_1505201908

Now I need to read each excel file and do some modification and then save it then need to mail the modified excel sheets .

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.