Unable to read the email body

Hi, I am reading an email body but it’s not reading.

2 Likes

Hi @balkishan,

What sort of error it is showing…

Regards
Mohanraj

Buddy @balkishan

What was the syntax you were using buddy

to get the mail body from the mailmessage variable obtained from any get mail activity
this should be the syntax buddy being inside the for each loop with mailmessage list as input to it
item.body.ToString
this would give the body of the mail buddy
Cheers @balkishan

1 Like

In For each loop ,argument type should be System.net.Mailmessage.

1 Like

No, bro. since it’s a html body. so Mail.Headers(“PlainText”) worked! :slight_smile:

3 Likes

How can I reads the yellow highlighted color text. since it’s a dynamic bro
image

you can do like this buddy, whether it is approved or rejected
once you get the plaintext form Mail.Headers(“PlainText”) assign it a variable like this
out_plaintext_array = plaintext.Split(Environment,Newline.ToArray())
where out_plaintext_array will be of array string type
–then use a for each loop with out_plaintext_array as input and type argument as string
and inside the for each loop use a if condition like this
item.Contains(“Approved”)
if the mail has the word Approved this condition will get passed and you can proceed further with the other activities in THEN part of if condition or with ELSE part of if condition
thats all buddy
Cheers @balkishan

3 Likes

@balkishan did that work buddy

1 Like

@Palaniyappan can you see bro

1 Like

Hey @balkishan
Use Like

Environment.Newline.ToArray().

Regards…!!
Aksh

1 Like

Hi @balkishan.

Please try
item.Headers(“HTMLBODY”).ToString

3 Likes

Buddy @balkishan
You were almost right
Its
Environment.Newline.ToArray()
Remove the space and comma between Environment and Newline buddy…

Cheers

1 Like

Thanks to @Palaniyappan @Jan_Brian_Despi and @aksh1yadav for your response :slight_smile:

2 Likes

Cheers buddy @balkishan
Keep going

1 Like

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