Announcement

Collapse
No announcement yet.

email package

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    email package

    Jon,

    Forgive me if this has been covered elsewhere. I looked, but I couldn't find it.

    I'm looking to parse the body of an email received based on the subject line of a message. I've read the docs and see how to trigger an event based on subject line contents.

    My question is how can I get the body of the message into a string so I can work on parsing it?

    Any direction you can send me would be greatly appreciated.

    Thanks for your time,

    Brian

    #2
    Update

    Well, I missed the section on the checkemail_trigger file. That's what I get for scanning rather than reading, eh?

    At any rate, I'm still not having any luck. I've set TriggerScript to 1 in the settings section of the ini file. I can see in the log that it is called, but I've evidently done something wrong. I've attached a snippet of my log file.

    If you take a look, it's as if the variables and labels aren't jiving up... and I think this is why the trigger isn't working. In the checkemail_trigger file, I used the example to create the following:

    If lcase(MailFrom)="xxxx@xxx.com" then hs.SetDeviceString "m4", "test of reception", True

    The device M4 never changes after receiving a message from the address in the above line. I wonder if it has something to do with what the log is showing.

    What am I doing wrong? (or what have I done wrong??)

    Running v3.0.22 here.

    Thanks for your patience...

    Brian
    Attached Files

    Comment


      #3
      There is a .vb and a .txt version of the trigger script. Make sure you delete/rename one of them to ensure that the program triggers it correctly. I believe it defaults to the .vb version which could be your problem.
      Jon

      Comment


        #4
        Thanks for your response.

        I've double checked the file being used, and in fact have now tried both files.

        The vb file does a better job for me, but it's not reporting the email subject in the log. Does that mean it's not seeing the subject at all?

        I'm also not able to get the message body, which was my original goal. I'm using the following in the checkemailPOP_trigger.vb file:

        If lcase(MailFrom)="xxxx@yahoo.com" then hs.setdevicestring ("m4", MailText, True)

        Any ideas?

        Brian

        Comment


          #5
          Brian,

          If you un-remark all the hs.writelog entries which displays all the email properties (Total messages, date, subject etc), do these display correctly apart from the subject/message body?

          Also please remember that this script will only run once for each new email that arrives so you will keep having to create new emails to test this.
          Jon

          Comment


            #6
            I've checked to make sure all the email property entries were un-remarked. I did un-remark the two dealing with the email body (body and body HTML).

            The log is still not reporting the subject, size, filecount, filenames, body, or body HTML.

            I've attached a log snippet.

            I am using the vb version of the script too.


            Brian
            Attached Files

            Comment


              #7
              Brian,

              This is most odd. When you receive new emails, does the script announce them correctly and can they be viewed in the web page?

              Just to confirm, you have:

              Set Triggerscript=1 under [settings] in the checkpop.ini file.
              You are using CheckemailPOP_Trigger.vb as the trigger file.

              I'm using the same version as you and set this up last night as a test. This was the email notification from your post here:


              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Total Messages in mailbox: 2
              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Mailbox number: 1
              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Message number: 2
              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Email address to: XXXX@btinternet.com
              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Email name to: Jon00
              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Email address from: XXXX@homeseer.com
              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Email name from: HomeSeer Message Board
              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Email date: Mon 12 Nov 2007 22:14:10 -0500
              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Email subject: Reply to post 'email package'
              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Email size: 3
              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Email filecount: 0
              13/11/2007 03:20:01 ~!~Jon00_Email~!~TriggerScript Test - Email filenames:
              Jon

              Comment


                #8
                Yep, I've checked all my settings.

                It's interesting - I ran into problem with another script - the addvoice command. Another user and I could take the exact same script and execute it. The script would work flawlessly for him, but wouldn't for me.

                It must be something with my system.

                Do you have any ideas as to how I can grab hold of the email body? I would like to parse the email body based on what's received in the subject line.

                Since I can't seem to see it at this point, I'm not sure how else to go about it.

                Thank you kindly for your time.

                Brian

                Comment


                  #9
                  You did not mention if emails were announced and displayed in the web page correctly?

                  Go to the CheckemailPOP_Trigger.vb script

                  Below the "do not edit above..." line, add the following:

                  Msgbox (Data)

                  Save then send a test email. Go to your Homeseer machine and trigger the event to check for new mail.

                  Check the contents of the message box which should appear on the screen - does this have the subject etc embedded within the string or is it still missing?
                  Jon

                  Comment


                    #10
                    Okay, I put "msgbox(data)" in the file and here's what was returned...


                    1|#|1|#|1|#|xxx@xxxx.com|#|Brian XXXX|#|xxxxx@xxxxxx.com|#|Brian XXXXX <xxxx@xxxxx.com>|#|Wed 14 Nov 2007 19:17:10 -0800 PST

                    It does receive messages fine and will announce the fact that it has received a message.

                    Comment


                      #11
                      I will have to send you a debug version... not sure when though. Could you send me an email so I can send it to you?

                      BTW, do you have it set to read the subject? If so, does that work?
                      Jon

                      Comment


                        #12
                        Well this gets more interesting (from my perspective).

                        All this time, I had been using yahoo to test for the subject. For the heck of it, I just now sent myself an email from a different email provider, and voila, the subject did show up. I tried it a couple more times from yahoo, and it's back to the same problem I had been describing.

                        Apparently, there's something going on between yahoo and this package. Hopefully it hasn't already been documented and I missed it!

                        At any rate, I'm going to see what I can do to work around the yahoo thing... probably try a different provider.

                        Have you seen this before? I'll PM you my email address just in case you decide you still want it for anything.

                        Brian

                        Comment


                          #13
                          Most odd? Have you tried sending email via Homeseer to see if that works?
                          Jon

                          Comment


                            #14
                            Originally posted by bpm32 View Post
                            Well this gets more interesting (from my perspective).

                            All this time, I had been using yahoo to test for the subject. For the heck of it, I just now sent myself an email from a different email provider, and voila, the subject did show up. I tried it a couple more times from yahoo, and it's back to the same problem I had been describing.
                            Brian
                            I've had that same problem. Subject comes in fine, except when sent through yahoo. I have yet to check whether every yahoo sourced message has this problem, however. It could possibly be a coincidence.

                            Jon, I can forward you one of the emails in question if that would help. I'd rather not post it in the forum if possible.
                            Last edited by RegForte; November 16, 2007, 04:36 PM.

                            Comment


                              #15
                              I'm not sure sending the email will do much good. Is this email sent via Yahoo web mail or their POP3 servers?? Funny thing is I'm on BT Yahoo here??
                              Jon

                              Comment

                              Working...
                              X