Kayako logo
How do I? Questions about how to do specific things in SupportSuite, eSupport and LiveResponse. Not for reporting problems.

Kayako develops robust helpdesk software, live chat and real-time visitor monitoring software.
Kayako is trusted by more than 30,000 organizations, including a number of Fortune 500 companies and government institutions.
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  (#1) Old
intel352 Offline
New Member
 
Posts: 5
Join Date: Jun 2007
Location: NC, USA
Having trouble creating mail parser rules that work - 30-08-2008, 03:27 AM

Hey all, I'm having a problem setting up mail parser rules that *work*.

I've just signed on to Kayako SupportSuite monthly lease.
I have an X-Cart store that I've set up to send emails to my support email address, once an order has been automatically moved to the Processed stage (I sell addons for X-Cart, so after a successful payment, the order is automatically marked as Processed).

My intention is to have orders automatically added to the work queue, as many orders include installation requests.

I've built a couple of parser rules listed below, please let me know if you see any obvious errors.

Currently the emails are passing through the rules, straight into the General ticket queue (I've been testing with orders that have a total of $0.00)

Quote:
  1. Rule: Ignore Orders
    Description: Intention is to ignore order emails that have a Total of $0.00
    Stop processing rules: Yes
    Execution Order: 1
    Match All Critera: Yes
    Rule Type: Pre Parse
    Reply To E-mail: empty
    Forward To: jon@XXXXX.com
    Ignore E-mail: Yes
    Do not send autoresponder message: Yes
    Do Not Process Ticket Alert Rules: Yes
    Do not parse as ticket reply: Yes
    • Match "Total: $0.00" in body
      • Body
      • Regular Expression
      • Code:
        ^((?=Total:\s+\$0\.00).)*$
        
    • Match "PHP Site Solutions: Order #XX notification" in subject
      • Subject
      • Regular Expression
      • Code:
        PHP Site Solutions: Order #[0-9]+ notification
        
  2. Rule: Fulfill Orders
    Description: Intention is to process (as a ticket) any orders that need fulfillment
    Stop processing rules: No
    Execution Order: 2
    Match All Critera: Yes
    Rule Type: Pre Parse
    Reply To E-mail: LONG MESSAGE HERE
    Forward To: jon@XXXXX.com
    Ignore E-mail: No
    Do not send autoresponder message: No
    Do Not Process Ticket Alert Rules: No
    Do not parse as ticket reply: No
    • Ignore email sent from support acct
      • Sender E-mail Address
      • Not Equal
      • support@XXXXX.com
    • DON'T Match "Total: $0.00" in body
      • Body
      • Regular Expression
      • Code:
        ^((?!Total:\s+\$0\.00).)*$
        
    • Match "PHP Site Solutions: Order #XX notification" in subject
      • Body
      • Regular Expression
      • Code:
        PHP Site Solutions: Order #[0-9]+ notification
        
    • Non-reply
      • Is Reply
      • Equal
      • False
   
Reply With Quote
  (#2) Old
intel352 Offline
New Member
 
Posts: 5
Join Date: Jun 2007
Location: NC, USA
30-08-2008, 03:31 AM

Here is an example email that should be automatically dropped, as per Rule #1

Code:
Delivered-To: support@XXXXX.com
Received: by XX.XXX.XX.XXX with SMTP id h1cs92014far;
        Fri, 29 Aug 2008 18:38:22 -0700 (PDT)
Received: by XX.XXX.XX.XXX with SMTP id n12mr4044091and.61.1220060301523;
        Fri, 29 Aug 2008 18:38:21 -0700 (PDT)
Return-Path: <anonymous@XXXXX.com>
Received: from XXXXX.com (178-67-162-69.static.reverse.lstn.net [XX.XXX.XX.XXX])
        by mx.google.com with ESMTP id b29si5349951ana.22.2008.08.29.18.38.20;
        Fri, 29 Aug 2008 18:38:21 -0700 (PDT)
Received-SPF: neutral (google.com: XX.XXX.XX.XXX is neither permitted nor denied by best guess record for domain of anonymous@XXXXX.com) client-ip=XX.XXX.XX.XXX;
Authentication-Results: mx.google.com; spf=neutral (google.com: XX.XXX.XX.XXX is neither permitted nor denied by best guess record for domain of anonymous@XXXXX.com) smtp.mail=anonymous@XXXXX.com
Received: (qmail 8088 invoked by uid 501); 30 Aug 2008 01:35:29 -0000
Date: 30 Aug 2008 01:35:29 -0000
Message-ID: <20080830013529.8087.qmail@XXXXX.com>
To: support@XXXXX.com
Subject: PHP Site Solutions: Order #77 notification
X-PHP-Script: phpsitesolutions.com/payment/payment_offline.php for 24.40.216.236
From: jon@XXXXX.com
X-Mailer: PHP/5.2.6
MIME-Version: 1.0
Content-Type: multipart/related;
    type="multipart/alternative";
     boundary="2620517025_48b8a"
Reply-to: jon@XXXXX.com


--2620517025_48b8a
Content-Type: multipart/alternative;
     boundary="2317732298_48b8a"

--2317732298_48b8a
Content-Type: text/plain;
    charset="iso-8859-1"
Content-Transfer-Encoding: 8bit


You have received this notification from PHP Site Solutions because you are a registered user or you or some other registered user requested some information for you from our store.
-------------------------------------------------------------------

This is an order #77 notification.


Order id:                          #77
Order date:                        Aug 29, 2008 08:35:29 PM
Order status:                      Queued


Customer info:
---------------------
Title:                             Mr.
First name:                        Jonathan
Last name:                         Langevin
Company:                           PHP Site Solutions
Phone:                             XXX-XXX-XXXX
E-mail:                            jon@XXXXX.com
URL:                               http://www.phpsitesolutions.com

Billing Address:
----------------
Address:                           ADDRESS CONTENT
Address (line 2):                  
City:                              CITY CONTENT
State:                             STATE CONTENT
Country:                           United States
Zip/Postal code:                   ZIP CONTENT

Shipping Address:
-----------------
 



Products ordered:
-----------------

SKU:                               DYNIMG
Product:                           Dynamic Images
Quantity:                          1
Selected options:
   xcart_version: X-Cart 4.1
   install: I'll install it myself
   customer_notes: Testing
Item price:                        $0.00


Total:
-------
Payment method:                    
Delivery method:                   
Subtotal:                          $0.00

Shipping cost:                     $0.00

Total:                             $0.00




--
Thank you for using
our shopping system

PHP Site Solutions
Phone:                             XXX-XXX-XXXX
URL:                               www.phpsitesolutions.com


--2317732298_48b8a
Content-Type: text/html;
    charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">

BODY {
    MARGIN-TOP: 10px; 
    MARGIN-BOTTOM: 10px;
    MARGIN-LEFT: 10px; 
    MARGIN-RIGHT: 10px;
    FONT-SIZE: 12px; 
    FONT-FAMILY: arial,helvetica,sans-serif
    PADDING: 0px;
}
TD {
    FONT-SIZE: 12px; 
    FONT-FAMILY: arial,helvetica,sans-serif
    COLOR: #000000;
}
TH {
    FONT-SIZE: 13px; 
    FONT-FAMILY: arial,helvetica,sans-serif
}
H1 {
    FONT-SIZE: 20px
}
TABLE,IMG,A {
    BORDER: 0px;
}

</style>
</head>
<body>

<p /><font size="2">
You have received this notification from <a href="http://www.phpsitesolutions.com/" target="_new">PHP Site Solutions</a> because you are a registered user or you or some other registered user requested some information for you from our store.
</font>


<p />This is an order #77 notification.


<p />
<table cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
<tr>
    <td>
    <table cellspacing="0" cellpadding="0" width="100%" border="0">
    <tr>
        <td width="100%">
        <table cellspacing="0" cellpadding="2" width="100%">
        <tr>
            <td valign="top">
<font style="FONT-SIZE: 28px"><b style="text-transform: uppercase;">Invoice</b></font>
<br /><br />
<b>Date:</b> Aug 29, 2008 08:35:29 PM<br /><b>Order id:</b> #77<br /><b>Order status:</b> Queued<br />
<b>Payment method:</b><br /><br /><b>Delivery method:</b><br />n/a            </td>
            <td valign="bottom" align="right">
<b>PHP Site Solutions</b><br />
ADDRESS CONTENT, CITY CONTENT<br />
ZIP CONTENT, STATE CONTENT<br />
United States<br />
CALL US: XXX-XXX-XXXX<br />E-mail: support@XXXXX.com<br />            </td>
        </tr>
        </table>
        </td>
    </tr>
    </table>
    <table cellspacing="0" cellpadding="0" width="100%" border="0">
    <tr>
        <td><img height="2" src="cid:spacer.gif" alt="" /></td>
    </tr>
    <tr>
        <td bgcolor="#000000"><img height="2" src="cid:spacer_black.gif" width="100%" alt="" /></td>
    </tr>
    <tr>
        <td><img height="2" src="cid:spacer.gif" width="1" alt="" /></td>
    </tr>
    </table>
    <br />
    <table cellspacing="0" cellpadding="0" width="45%" border="0">
    <tr>
        <td><b>Title:</b></td>
        <td>Mr.</td>
    </tr>
    <tr>
        <td nowrap="nowrap"><b>First name:</b></td>
        <td>Jonathan</td>
    </tr>
    <tr>
        <td nowrap="nowrap"><b>Last name:</b></td>
        <td>Langevin</td>
    </tr>
    <tr>
        <td><b>Company:</b></td>
        <td>PHP Site Solutions</td>
    </tr>
    <tr>
        <td><b>Phone:</b></td>
        <td>XXX-XXX-XXXX</td>
    </tr>
    <tr>
        <td><b>E-mail:</b></td>
        <td>jon@XXXXX.com</td>
    </tr>
    <tr>
        <td><b>URL:</b></td>
        <td>http://www.phpsitesolutions.com</td>
    </tr>
    </table>
    <br />
    <table cellspacing="0" cellpadding="0" width="100%" border="0">
    <tr>
        <td width="45%" height="25"><b>Billing Address</b></td>
        <td width="10%">&nbsp;</td>
        <td width="45%" height="25"><b>Shipping Address</b></td>
    </tr>
    <tr>
        <td bgcolor="#000000" height="2"><img height="2" src="cid:spacer_black.gif" width="100%" alt="" /></td>
        <td><img height="2" src="cid:spacer.gif" width="1" alt="" /></td>
        <td bgcolor="#000000" height="2"><img height="2" src="cid:spacer_black.gif" width="100%" alt="" /></td>
    </tr>
    <tr>
        <td colspan="3"><img height="2" src="cid:spacer.gif" width="1" alt="" /></td>
    </tr>
    <tr>
        <td>
        <table cellspacing="0" cellpadding="0" width="100%" border="0">
        <tr>
            <td><b>Address:</b> </td>
            <td>ADDRESS CONTENT<br /></td>
        </tr>
        <tr>
            <td><b>City:</b> </td>
            <td>CITY CONTENT</td>
        </tr>
        <tr>
            <td><b>State:</b> </td>
            <td>STATE CONTENT</td>
        </tr>
        <tr>
            <td><b>Country:</b> </td>
            <td>United States</td>
        </tr>
        <tr>
            <td><b>Zip/Postal code:</b> </td>
            <td>ZIP CONTENT</td>
        </tr>
        </table>
        </td>
        <td>&nbsp;</td>
        <td>
        <table cellspacing="0" cellpadding="0" width="100%" border="0">
        </table>
        </td>
    </tr>





    </table>
    <br />
    <br />

<table cellspacing="0" cellpadding="0" width="100%" border="0">

<tr>
<td align="center"><font style="FONT-SIZE: 14px; FONT-WEIGHT: bold;">Products ordered</font></td>
</tr>

</table>

<table cellspacing="0" cellpadding="3" width="100%" border="1">

<tr>
<th width="60" bgcolor="#cccccc">SKU</th>
<th bgcolor="#cccccc">Product</th>
<th nowrap="nowrap" width="100" bgcolor="#cccccc" align="center">Item price</th>
<th width="60" bgcolor="#cccccc">Quantity</th>
<th width="60" bgcolor="#cccccc">Total<br /><img height="1" src="cid:spacer.gif" width="50" border="0" alt="" /></th>
</tr>

<tr>
<td align="center">DYNIMG</td>
<td><font style="FONT-SIZE: 11px">Dynamic Images</font>
<table>

<tr>
<td valign="top"><b>Options:</b></td> 
<td><table cellspacing="1" cellpadding="0">
<tr>
    <td>X-Cart Version:&nbsp;</td>
    <td>X-Cart 4.1</td>
</tr>
<tr>
    <td>Installation:&nbsp;</td>
    <td>I'll install it myself</td>
</tr>
<tr>
    <td>Additional notes:&nbsp;</td>
    <td>Testing</td>
</tr>
</table>
</td>
</tr>

</table>
</td>
<td align="right" nowrap="nowrap"><span style="WHITE-SPACE: nowrap">$0.00</span>&nbsp;&nbsp;</td>
<td align="center">1</td>
<td align="right" nowrap="nowrap"><span style="WHITE-SPACE: nowrap">$0.00</span>&nbsp;&nbsp;</td>
</tr>


</table>
<table cellspacing="0" cellpadding="0" width="100%" border="0">

<tr>
<td align="right" width="100%" height="20"><b>Subtotal:</b>&nbsp;</td>
<td align="right"><span style="WHITE-SPACE: nowrap">$0.00</span>&nbsp;&nbsp;&nbsp;</td>
</tr>










<tr>
<td bgcolor="#000000" colspan="2"><img height="2" src="cid:spacer_black.gif" width="100%" alt="" /></td>
</tr>

<tr>
<td align="right" bgcolor="#cccccc" height="25"><b>Total:</b>&nbsp;</td>
<td align="right" bgcolor="#cccccc"><b><span style="WHITE-SPACE: nowrap">$0.00</span></b>&nbsp;&nbsp;&nbsp;</td>
</tr>




</table>



    </td>
</tr>


<tr>
<td align="center"><br /><br /><font style="FONT-SIZE:12px">Thank you for your purchase!</font></td>
</tr>

</table>
<hr size="1" noshade="noshade" />
Thank you for using
our shopping system
<p><font size="2">
PHP Site Solutions<br />
Phone: XXX-XXX-XXXX<br />
Website:   <a href="http://www.phpsitesolutions.com/" target="_new">www.phpsitesolutions.com</a>
</font></p>
</body>
</html>

--2317732298_48b8a--

--2620517025_48b8a
Content-Type: image/gif;
    name="spacer.gif"
Content-Transfer-Encoding: base64
Content-ID: <spacer.gif>

R0lGODlhAQABAPAAAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAICTAEAOw==


--2620517025_48b8a
Content-Type: image/gif;
    name="spacer_black.gif"
Content-Transfer-Encoding: base64
Content-ID: <spacer_black.gif>

R0lGODlhAQABAIAAAAAAAP///yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==


--2620517025_48b8a--
   
Reply With Quote
  (#3) Old
intel352 Offline
New Member
 
Posts: 5
Join Date: Jun 2007
Location: NC, USA
30-08-2008, 05:52 AM

I figured it out. First of all, my regex was bad (I thought it had tested positive, but retesting showed it didn't)

And secondly, I had to figure out how the regex should be saved to Kayako. Turns out you need to save a complete matching regular expression, same as what you would use in a PHP preg_* function.

So these are the 2 regexes that I've come up with, that match properly now:

Match an email that should be ignored
Code:
/Total:\s+\$0\.00\n/

Match an email that should be fulfilled as an order

Code:
/Total:\s+\$[0-9]+\.[0-9]+(?<!0\.00)\n/
   
Reply With Quote
  (#4) Old
Jamie Edwards Offline
Operations Manager
 
Jamie Edwards's Avatar
 
Posts: 7,372
Join Date: Jan 2006
Location: England, UK
30-08-2008, 02:14 PM

Well done on getting it sorted, and for sharing your regex strings. I agree that regex is an absolute pain. In Version 4, we'll add some build-in regex testers to make creating them and testing them easier.


Jamie Edwards (jamie.edwards ]at[ kayako.com)
----------------------------------------------------------------
---
   
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail parser -> Rules and regular expressions for headers AllanMar Mail parser 4 11-04-2008 03:30 PM
Mail Parser Rules and Custom Fields silarsis How do I? 1 17-10-2007 08:29 AM
Mail parser -> Rules -> More parser rules pertaining to ticket Solvent LLC Mail parser 3 29-07-2007 09:15 AM
Mail parser -> Rules -> Option to enable or disable rules richm Mail parser 2 11-07-2007 07:05 PM
Error Creating Tables Danym SupportSuite, eSupport and LiveResponse 1 03-11-2006 10:22 AM



Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78