Hey,
I’m new to Ruby and I need some help to finish my task. Basically I’m
getting a string from db which is an email content.
The string is as follows :
MIME-Version: 1.0
Content-Transfer-Encoding: 8-bit
Content-Type: multipart/mixed; boundary="__AWSQUEUE__RMWFETWJOGMKIVYQ"
This is a multi-part message in MIME format.
–__AWSQUEUE__RMWFETWJOGMKIVYQ
Content-Type: text/plain
[KUMO][TEST] Automated Selenium test 2013/04/18 15:37:49 1366299469495
–__AWSQUEUE__RMWFETWJOGMKIVYQ—
Now I want to parse the above string for body using MIME parse.
Here is my code:
mail=TMail::Mail.parse(tempCommText)
body = mail.body.to_s
This is where I’m running into problem. The parser is having some
problem with empty lines/white line characters.
Error Message:
ERROR: undefined method `blank?’ for
{“boundary”=>""__AWSQUEUE__RMWFETWJOGMKIVYQ""
So I thought of replacing them using gsub(/^[\s]*$\n/, ‘’) but I’m
running into below issue.
ERROR – : ERROR: wrong mail header: ‘“This is a multi-part message in
MIME format.\n”’
This thing is really blocking my work and any help is appreciated.
Thanks in advance.