Ho to get data from Email body into an array

I am using screen scraping and getting body of the outlook email. And now i want some of the values in email body where as its showing whole body as string how can i change string into an array so that i can get the required values by using index. and also how can i use .ToArray option

Thanks in advance

Hi,
You could have make use of item.body (system.net.mail.mailmessages)which gives you body of the mail in string format. i don’t think scraping is necessary anyway . :slight_smile:
Post to that use split method to convert to array and use indexing and sub string to get required field.
var result = myString.Split(β€˜,’);

2 Likes

Hi,

in addition to what @ddpadil said you could split your body by each row of text so it will be easier to parse wanted values.
myArray = emailBody.Split({ Environment.Newline }, StringSplitOptions.RemoveEmptyEntries)
This will create an array of the body without the empty lines.