Announcement

Collapse
No announcement yet.

eMailing an Attachment

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

    eMailing an Attachment

    I have the following attachement defined for my NetCam pictures.
    'C:\Program Files\HomeSeer HSPRO\html\netcam\Chick Kitchen*.jpg - I can however, send an email if I simply just leave off the attachement. So I do know the problem is with sending attachments.


    I receive the following error: 7/5/2011 12:39:52 AM Error Building SMTP message for sending: Invalid mail attachment 'C:\Program Files\HomeSeer HSPRO\html\netcam\Chick Kitchen*.jpg'.


    How is the correct way to send the email attachments? I tried leaving off C:\Program Files\HomeSeer HSPRO so I know that does not seem to be the answer. I also tried *.jpg.

    Cheers,
    Gary

    #2
    Are you trying to send more than one image using the *? If so this will not work and you would most likely have to zip them into a single file for this to work.
    -Rupp
    sigpic

    Comment


      #3
      The problem might be the spaces in the path name, and could require a delimiter around it (single or double quotes).


      Originally posted by jgary View Post
      I have the following attachement defined for my NetCam pictures.
      'C:\Program Files\HomeSeer HSPRO\html\netcam\Chick Kitchen*.jpg - I can however, send an email if I simply just leave off the attachement. So I do know the problem is with sending attachments.


      I receive the following error: 7/5/2011 12:39:52 AM Error Building SMTP message for sending: Invalid mail attachment 'C:\Program Files\HomeSeer HSPRO\html\netcam\Chick Kitchen*.jpg'.


      How is the correct way to send the email attachments? I tried leaving off C:\Program Files\HomeSeer HSPRO so I know that does not seem to be the answer. I also tried *.jpg.

      Cheers,
      Gary

      Comment


        #4
        Thanks Rupp I was not aware I could not send mutiple images this way. I will try to zip them, just don't know if I can un zip them on my phone when they arrive. -- Tks.. Gary

        Comment


          #5
          Help Needed zipping and emailing attachments

          I am having no luck zipping and emailing my net cam pictures. I have a script and everything is working in it where I take the pictures etc, except the zipping of the jpg files.

          Below is the line can someone give me a hand....

          hs.launch "c:\Program Files\winzip\winzip32", "-min -a -ex C:\Program Files\HomeSeer HSPRO\Camera Archives\images.zip C:\Program Files\HomeSeer HSPRO\html\netcam\*.jpg"

          I keep getting an error from winzip that no files were found plus this error below from HomeSeer

          7/13/2011 1:30:10 AM - Error - Building SMTP message for sending: Invalid mail attachment 'C:\Program Files\HomeSeer HSPRO\html\netcam\images.zip'.

          Cheers - Gary

          Comment


            #6
            Originally posted by jgary View Post
            I am having no luck zipping and emailing my net cam pictures. I have a script and everything is working in it where I take the pictures etc, except the zipping of the jpg files.

            Below is the line can someone give me a hand....

            hs.launch "c:\Program Files\winzip\winzip32", "-min -a -ex C:\Program Files\HomeSeer HSPRO\Camera Archives\images.zip C:\Program Files\HomeSeer HSPRO\html\netcam\*.jpg"

            I keep getting an error from winzip that no files were found plus this error below from HomeSeer

            7/13/2011 1:30:10 AM - Error - Building SMTP message for sending: Invalid mail attachment 'C:\Program Files\HomeSeer HSPRO\html\netcam\images.zip'.

            Cheers - Gary
            Try and use HS's own zip function - don't worry about using Winzip by command line.

            hs.zip(hs.getapppath & "\html\netcam\", hs.getapppath & "\Camera Archives\images.zip")

            I can't remember what sort of files are actually in the NetCam directory - I take it there are web files you do not want to copy into the zip file (which is why you are using *.jpg - I don't think it works that way(?))?

            If so then the only option I can see is 1) find out the names of all of the jpg's (perhaps using one of the System.IO.File functions) in the directory and add them to the zip file individually 2) Just include all of the files if they are not too big or 3) see if you can move the directory somewhere where only images can be stored

            The second error is directly related to the first, without the zip file being generated you won't be able to attach it

            Comment


              #7
              Originally posted by jgary View Post
              I am having no luck zipping and emailing my net cam pictures. I have a script and everything is working in it where I take the pictures etc, except the zipping of the jpg files.

              Below is the line can someone give me a hand....

              hs.launch "c:\Program Files\winzip\winzip32", "-min -a -ex C:\Program Files\HomeSeer HSPRO\Camera Archives\images.zip C:\Program Files\HomeSeer HSPRO\html\netcam\*.jpg"

              I keep getting an error from winzip that no files were found plus this error below from HomeSeer

              7/13/2011 1:30:10 AM - Error - Building SMTP message for sending: Invalid mail attachment 'C:\Program Files\HomeSeer HSPRO\html\netcam\images.zip'.

              Cheers - Gary
              You might need to use the paths without spaces.

              Maybe like this:

              hs.launch "c:\Program Files\winzip\winzip32", "-min -a -ex C:\Progra~1\HomeSee~1\Camera~1\images.zip C:\Progra~1\HomeSee~1\html\netcam\*.jpg"

              or this:

              hs.launch "c:\Program Files\winzip\winzip32", "-min -a -ex 'C:\Program Files\HomeSeer HSPRO\Camera Archives\images.zip' 'C:\Program Files\HomeSeer HSPRO\html\netcam\*.jpg' "

              I run a script that grabs the latest and sends an email with that as the attachment. The benefit of that is the 'latest' always has the same name. No script is required, just a recurring event that runs shortly after the netcam image update event.
              huggy_d1

              Automating made easy

              Comment


                #8
                Since I am facing the same dilemma, can someone clarify one thing for me: is there a way for a Netcam plugin to:
                1. Take five shots 0.5 sec apart
                2. attach them to email and send that email via event
                3. delete these shots from storage directory

                Using the tips above about zipping and emailing images is sort-of OK, but if I am monitoring a frequently used area, say a front door, then i will wind up with a progressively growing directory that needs to be manually emptied, right?

                Isn't there a way to e-mail a few snapshots from an IP Cam in HomeSeer? I know that if I activate motion alarm, then my Foscam cam can e-mail me those pics. How do I do the same thing via HomeSeer, so that pics are taken when I define them by event, not via constantly triggered motion alarm?

                Comment


                  #9
                  Originally posted by VirtualPanther View Post
                  Since I am facing the same dilemma, can someone clarify one thing for me: is there a way for a Netcam plugin to:
                  1. Take five shots 0.5 sec apart
                  2. attach them to email and send that email via event
                  3. delete these shots from storage directory

                  Using the tips above about zipping and emailing images is sort-of OK, but if I am monitoring a frequently used area, say a front door, then i will wind up with a progressively growing directory that needs to be manually emptied, right?

                  Isn't there a way to e-mail a few snapshots from an IP Cam in HomeSeer? I know that if I activate motion alarm, then my Foscam cam can e-mail me those pics. How do I do the same thing via HomeSeer, so that pics are taken when I define them by event, not via constantly triggered motion alarm?
                  #1 is build into the netcam plug-in as a netcam event action.
                  #2 is not built into the plug-in. A script to grab those 5 latest (date-
                  descending sorted) images and send via email should not be too difficult. There's probably a vb.net or vbscript example online somewhere.
                  #3 is not necessary as the netcam plug-in automatically manages how many images it allows. You configure the plug-in for how many images to keep (or at least how long to keep them, don't remember the setup, but once you set it, you forget it

                  Another option would be to send the images from the foscam ip cam to HS, then have HS decide whether to forward to you.... Seems like duplication of effort, but unless you're willing to dig into some scripts, or someone has it written and posts it, you may have to settle for that option.

                  Hope it helps, and mostly, hope it makes sense.
                  huggy_d1

                  Automating made easy

                  Comment


                    #10
                    Originally posted by VirtualPanther View Post
                    Since I am facing the same dilemma, can someone clarify one thing for me: is there a way for a Netcam plugin to:
                    1. Take five shots 0.5 sec apart
                    2. attach them to email and send that email via event
                    3. delete these shots from storage directory

                    Using the tips above about zipping and emailing images is sort-of OK, but if I am monitoring a frequently used area, say a front door, then i will wind up with a progressively growing directory that needs to be manually emptied, right?

                    Isn't there a way to e-mail a few snapshots from an IP Cam in HomeSeer? I know that if I activate motion alarm, then my Foscam cam can e-mail me those pics. How do I do the same thing via HomeSeer, so that pics are taken when I define them by event, not via constantly triggered motion alarm?
                    http://board.homeseer.com/showthread.php?t=88659

                    this is a link to a script from a number of years ago. It will capture images from a defined port #, zip them, and email them to you. I've been using for years!

                    Comment


                      #11
                      Originally posted by VirtualPanther View Post
                      Since I am facing the same dilemma, can someone clarify one thing for me: is there a way for a Netcam plugin to:
                      1. Take five shots 0.5 sec apart
                      2. attach them to email and send that email via event
                      3. delete these shots from storage directory

                      Using the tips above about zipping and emailing images is sort-of OK, but if I am monitoring a frequently used area, say a front door, then i will wind up with a progressively growing directory that needs to be manually emptied, right?

                      Isn't there a way to e-mail a few snapshots from an IP Cam in HomeSeer? I know that if I activate motion alarm, then my Foscam cam can e-mail me those pics. How do I do the same thing via HomeSeer, so that pics are taken when I define them by event, not via constantly triggered motion alarm?
                      I have events that use NetCam to take pics 1 sec apart for 30 seconds.
                      Every night at midnight, I archive the images in the NetCam folder off to an external drive. I dont zip them up, but I do create a subfolder for each day and have that day's images inside the subfolder.

                      If you want the code that mvoes them off to external storage, let me know and I'll post here. You could probably easily modify it to zip up.

                      One more thing, I dont email the images out. I do update a virtual device with how many images are present for that day and display it on my quickview mage.
                      HS4Pro Running on a Raspberry Pi4
                      68 Z-Wave Nodes, 175 Events, 359 Devices
                      UPB modules via OMNI plugin/panel
                      Plugins: Z-Wave, OMNI, HSTouch, weatherXML, EasyTrigger
                      HSTouch Clients: 3 Android, 1 Joggler

                      Comment


                        #12
                        Originally posted by rmasonjr View Post
                        I have events that use NetCam to take pics 1 sec apart for 30 seconds.
                        Every night at midnight, I archive the images in the NetCam folder off to an external drive. I dont zip them up, but I do create a subfolder for each day and have that day's images inside the subfolder.

                        If you want the code that mvoes them off to external storage, let me know and I'll post here. You could probably easily modify it to zip up.

                        One more thing, I dont email the images out. I do update a virtual device with how many images are present for that day and display it on my quickview mage.
                        I'd love to know how to do that. It's all a mystery to me... I just want to know who was at the front door, you know?

                        Comment


                          #13
                          Originally posted by VirtualPanther View Post
                          I'd love to know how to do that. It's all a mystery to me... I just want to know who was at the front door, you know?
                          yep - me too. I trigger my netcam event on doorbell press, motion, etc.
                          Here's the code that moves everything. I havent set it up to purge yet, but the meat of the program is in there. Save it as a .vb in your scripts folder, edit the constants at the top with your info and set it up in a nightly event to run just after midnight:

                          Code:
                          Imports System.IO
                          
                              Public Const NETCAM_FOLDER As String = "c:\program files\homeseer 2\html\netcam\"
                              Public Const STORAGE_FOLDER As String = "\\homeseer\d\campics\eastcam\"
                              Public Const PURGE_DAYS As Integer = 30
                          
                              Public Sub Main(ByVal parms As Object)
                          
                                  Dim yesterday As Date = DateAdd(DateInterval.Day, -1, Now)
                                  Dim dest As String = STORAGE_FOLDER & yesterday.ToString("yyyyMMdd") ''destination folder
                                  Dim ct As Integer = 0
                                  Dim files As String()
                                  Dim file As String
                                  Dim di As DirectoryInfo = New DirectoryInfo(NETCAM_FOLDER)
                          
                                  files = Directory.GetFiles(NETCAM_FOLDER, "*.jpg")
                                  ''loop through the netcam pics and move them to the destination folder
                                  If (files.Length > 0) Then ''we have some files to move
                                      ''create the destination folder - ignore if it already exists
                                      Try
                                          FileSystem.MkDir(dest)
                                      Catch e As IOException
                                          ''hs.WriteLog("netcamMaint", "Unable to create [" & dest & "] already exists: " & e.Message)
                                      End Try
                                      ct = files.Length
                                      Try
                                          For Each file In files
                                              My.Computer.FileSystem.MoveFile(file, dest & "\" & My.Computer.FileSystem.GetName(file))
                                          Next
                                      Catch e As Exception
                                          hs.WriteLog("netcamMaint", e.Message)
                                      End Try
                                  End If
                          
                              End Sub
                          HS4Pro Running on a Raspberry Pi4
                          68 Z-Wave Nodes, 175 Events, 359 Devices
                          UPB modules via OMNI plugin/panel
                          Plugins: Z-Wave, OMNI, HSTouch, weatherXML, EasyTrigger
                          HSTouch Clients: 3 Android, 1 Joggler

                          Comment


                            #14
                            Originally posted by rmasonjr View Post
                            yep - me too. I trigger my netcam event on doorbell press, motion, etc.
                            Here's the code that moves everything. I havent set it up to purge yet, but the meat of the program is in there. Save it as a .vb in your scripts folder, edit the constants at the top with your info and set it up in a nightly event to run just after midnight:

                            Code:
                            Imports System.IO
                            
                                Public Const NETCAM_FOLDER As String = "c:\program files\homeseer 2\html\netcam\"
                                Public Const STORAGE_FOLDER As String = "\\homeseer\d\campics\eastcam\"
                                Public Const PURGE_DAYS As Integer = 30
                            
                                Public Sub Main(ByVal parms As Object)
                            
                                    Dim yesterday As Date = DateAdd(DateInterval.Day, -1, Now)
                                    Dim dest As String = STORAGE_FOLDER & yesterday.ToString("yyyyMMdd") ''destination folder
                                    Dim ct As Integer = 0
                                    Dim files As String()
                                    Dim file As String
                                    Dim di As DirectoryInfo = New DirectoryInfo(NETCAM_FOLDER)
                            
                                    files = Directory.GetFiles(NETCAM_FOLDER, "*.jpg")
                                    ''loop through the netcam pics and move them to the destination folder
                                    If (files.Length > 0) Then ''we have some files to move
                                        ''create the destination folder - ignore if it already exists
                                        Try
                                            FileSystem.MkDir(dest)
                                        Catch e As IOException
                                            ''hs.WriteLog("netcamMaint", "Unable to create [" & dest & "] already exists: " & e.Message)
                                        End Try
                                        ct = files.Length
                                        Try
                                            For Each file In files
                                                My.Computer.FileSystem.MoveFile(file, dest & "\" & My.Computer.FileSystem.GetName(file))
                                            Next
                                        Catch e As Exception
                                            hs.WriteLog("netcamMaint", e.Message)
                                        End Try
                                    End If
                            
                                End Sub
                            I will try that. Thanks!
                            P.S.: what do you do to view these pics remotely on iPhone? I mean, if there is someone at the door and netcam takes a set of pics and HS sends me an email, what is the best way to quickly look who was there?

                            Comment


                              #15
                              Originally posted by VirtualPanther View Post
                              I will try that. Thanks!
                              P.S.: what do you do to view these pics remotely on iPhone? I mean, if there is someone at the door and netcam takes a set of pics and HS sends me an email, what is the best way to quickly look who was there?
                              Sorry - dont have an iPhone On Android, I know you can view attachments and save them to the "gallery" for viewing.
                              HS4Pro Running on a Raspberry Pi4
                              68 Z-Wave Nodes, 175 Events, 359 Devices
                              UPB modules via OMNI plugin/panel
                              Plugins: Z-Wave, OMNI, HSTouch, weatherXML, EasyTrigger
                              HSTouch Clients: 3 Android, 1 Joggler

                              Comment

                              Working...
                              X