Skip to content Skip to sidebar Skip to footer

How To Parse Email Body With Robot Framework

I'm tryin to parse a specific string from an email(gmail) using the ImapLibrary2 in Robot Framework. Here is the code I'm trying to use - Email Parsing Open Mailbox host=imap.g

Solution 1:

I was able to parse the required element by-

Step 1: Remove unnecessary string using Regular Expression Step 2: Splitting the string Step 3: Getting the required element from the list

Here is the sample code-

Open Mailbox    host=imap.gmail.com    user=testing.abc@gmail.com    password=Secret
${LATEST} =     Wait For Email    sender=support@abc.net    timeout=60${HTML} =       Get Email Body    ${LATEST}
${Paser_Body}=  Remove String Using Regexp    ${HTML}    (<.*?>)    #remove tags${Parsed_Token}=    Split String    ${Parser_Body_Text}
${Parsed_Token}=    Get From List    ${Parsed_Token}    20#position in the list
Close Mailbox

Post a Comment for "How To Parse Email Body With Robot Framework"