CA Service Management

Expand all | Collapse all

filtering out embedded spaces (not tabs) in front of maileater tags on email clients

Jump to Best Answer
  • 1.  filtering out embedded spaces (not tabs) in front of maileater tags on email clients

    Posted 12-07-2017 04:27 PM

    Hey folks,

     

    I'm raising this on behalf of a customer.   The use case is that, they send an email notification out to users,  that email notification has below items at the bottom of the email:

     

    %REQUEST_ID=1234

    %STATUS=Customer Updated

     

     

    User replies to this email, and the ticket status should get updated to Customer Updated. 

     

    This works fine, as long as the above tags are on a new line by themselves without any embedded spaces in front of them.  But they have some a mail client that auto-indents the above email notification (on a reply) and pads them in front with about 3 or 4 embedded spaces.   That goofs up the maileater completely and it misses the tags. 

     

    He was wondering if anyone has some ideas on any options (Office 365. mail server rules  of some sort) that'll format this per what mail eater expects normally, one tag per line.

     

     


    Thx

    _R



  • 2.  Re: filtering out embedded spaces (not tabs) in front of maileater tags on email clients

    Posted 12-08-2017 03:38 AM

    Hi,

     

    you can prevalidate emails customizing NX_ROOT\bin\text_api.pl but I haven't tried it by myself.

    I hope that daniel-bighelini could provide more info.

     

    Regards,

    cdtj



  • 3.  Re: filtering out embedded spaces (not tabs) in front of maileater tags on email clients
    Best Answer

    Posted 12-08-2017 04:22 AM

    Hi,

    I think the best way to do this is to create a rule in the mailbox based on the body of the message by validating a specific regex and. Ex.:

     

     [\r\n\t ]Incident {{object_id}}[\r\n\t ]

     

    Then configuring in the TextAPI Defaults section the fields and values that should be updated in the ticket. Ex.:
    INCIDENT.STATUS=Customer Updated

     

    If this is not possible, you would need to customize the $NX_ROOT\bin\text_api.pl file by applying a regex to the read_input function, thus removing any HTML / Rich Text formatting and any spaces or indentations in the % tags.

    Ex.: s/<[^>]*>//g;

    I ended up using the second option because I had similar problems in email processing.



  • 4.  Re: filtering out embedded spaces (not tabs) in front of maileater tags on email clients

    Posted 12-08-2017 11:14 AM

    Thank you Daniel and Timur.  That helps. I'll recommend my customer to start following this thread too.

     

    Thanks again

    _R



  • 5.  Re: filtering out embedded spaces (not tabs) in front of maileater tags on email clients

    Posted 12-08-2017 04:08 PM

    From what I can tell the TextAPI Defaults only apply to creating a new ticket and don't apply on update.

     

    Tried this but doesn't seem to be working when I test. 

     

    #remove any UTF8 Byte Order Marks
    s/$UTF8_BOM//g;

     

    #remove all leading whitespace

    s/<[^>]*>//g;


    # remove all trailing white space
    s/^(.*)\s*$/$1/;

     

    I'm not familiar with this language so I'm sure that has a lot to do with it not working.



  • 6.  Re: filtering out embedded spaces (not tabs) in front of maileater tags on email clients

    Posted 12-11-2017 09:04 AM

    Hi Raghu\Daniel,

     

    Please confirm that if we just need to add 's/<[^>]*>//g;' in the section where the other two are defined as per Joe or is there anything else that needs to change in that file to effect this change?

     

    ===

    Kind Regards,

    Brian



  • 7.  Re: filtering out embedded spaces (not tabs) in front of maileater tags on email clients

    Posted 12-11-2017 09:16 AM
    It is necessary to add in the read_input function of the text_api.pl file the following excerpt:
    #remove any UTF8 Byte Order Marks
    s/$UTF8_BOM//g;
           
    # remove all trailing white space
    s/^(.*)\s*$/$1/;
           
    # To test changes, use: pdm_perl text_api.pl -f "D:\Program Files (x86)\CA\Service Desk Manager\site\ text_api.cfg" -e Incident -s
    # To remove all HTML tags
    s/<[^>]*>//g;
    # Remove all asterisks around strings
    # To circumvent the RichText conversion situation for Text / Plain
    s/\*//g;
    Then, execute the commands below:
    pdm_kill pdm_text_nxd
    (wait 5 seconds)
    pdm_kill pdm_maileater_nxd


  • 8.  Re: filtering out embedded spaces (not tabs) in front of maileater tags on email clients

    Posted 12-22-2017 01:26 PM

    This isn't working for me. I've added in the 

    # To remove all HTML tags
    s/<[^>]*>//g;
    to the site/bin file. I've done the refreshes and it's not picking up the status in the email
        %Request_ID=830970
        %STATUS=Customer Updated