Announcement

Collapse
No announcement yet.

UltraSMTP3 Scripting

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

    UltraSMTP3 Scripting

    Hi, I just bought the new version and I cannot get the scripting to work. I tried this:

    hs.PluginFunction("UltraSMTP3","","SendMail",New Object(){MyEmailAddress, "Camera Event", strBody, MailAttachments})

    I am getting:

    Method SendMail does not exist in UltraSMTP3.

    Any tips on what I'm doing wrong would be helpful! Thanks

    #2
    Ultra, Is scripting available on UltraSMTP3?

    Comment


      #3
      No, not yet. I am trying to talk Rich into adding a callback allowing my plug-in to handle the HomeSeer SendEmail function. If I don't get a reply within a week or two, I'll add the SendEmail API to UltraSMTP3.

      Regards,
      Ultrajones
      Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

      Comment


        #4
        Thanks for the update Ultra. Looking forward to getting my HS2 scripts working with UltraSMTP3 again!

        Comment


          #5
          Hi Ultra, any progress on UltraSMTP scripting support? Thanks

          Comment


            #6
            Hello madmax. Sorry for the delay. I just uploaded UltraSMTP3 HSPI version 3.0.5154.34199 that includes the SendMail function.

            Code:
            sub Main(parm as object)
            
                Try
                 Dim ToAddr As String = "nobody@nowhere.com"
                 Dim Subject As String = "UltraSMTP3 Notification"
                 Dim Body As String = "This is an e-mail notification sent on $date."
                 Dim Attachments() As String = Nothing
              
                 hs.PluginFunction("UltraSMTP3", "", "SendMail", New Object() {ToAddr,Subject,Body,Attachments}) 
            
                Catch pEx As Exception
                  '
                  ' Process program exception
                  '
                  hs.WriteLog("Error", pEx.Message)
                End Try
            
            End Sub
            Regards,
            Ultrajones
            Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

            Comment


              #7
              Thanks Ultra, Can you tell me if attachments are supported? My emails are sending fine but it's not including the attachments:

              I'm doing a:

              ReDim Attachments(0)
              Attachments(0) = newfilename


              where newfilename is a path to a file.

              Comment


                #8
                This script works on my system:

                Code:
                sub Main(parm as object)
                
                    Try
                     Dim ToAddr As String = "nobody@nowhere.com"
                     Dim Subject As String = "UltraSMTP3 Notification"
                     Dim Body As String = "This is an e-mail notification sent on $date."
                     Dim Attachments() As String = Nothing
                
                     ReDim Attachments(0)
                     Attachments(0) = "C:\Program Files (x86)\HomeSeer HS3\html\images\hspi_ultranetcam3\snapshots\NetCam001\last_snapshot.jpg"
                  
                     hs.PluginFunction("UltraSMTP3", "", "SendMail", New Object() {ToAddr,Subject,Body,Attachments}) 
                
                    Catch pEx As Exception
                      '
                      ' Process program exception
                      '
                      hs.WriteLog("Error", pEx.Message)
                    End Try
                
                End Sub
                Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

                Comment


                  #9
                  It's not working for me even though hs.sendmail is working:

                  ReDim Attachments(0)
                  Attachments(0) = newfilename
                  Dim LogText As String = "Sending " & Attachments(0) & " to " & ToAddr
                  hs.WriteLogDetail(LogTitle, LogText, LogColor, 98, "Camera Event Email Send", 0)

                  hs.SendEmail(ToAddr, "myfromemailaddress@gmail.com", "", "", Subject, "This Email is From hs.SendEmail", Attachments(0))

                  hs.PluginFunction("UltraSMTP3", "", "SendMail", New Object() {ToAddr,Subject,Body,Attachments})

                  I get 2 emails. One from hs.sendemail that contains the attached mp4 video attachment. The email received by UltraSMTP has no attachment. I've enabled debug logging and restarted HSPRO, but that doesn't appear to increase logging from what I can tell.

                  Comment


                    #10
                    Please try the version I just uploaded to the HomeSeer updater. It adds a lot of debug so we can see what is going on.

                    Regards,
                    Ultrajones
                    Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

                    Comment


                      #11
                      I installed the new version and I'm not seeing enhanced debugging logs despite setting it to debug on the ultrasmtp options page. Also, I just created a regular UltraSMTP3 event that sends an attachment and that too, isn't sending an attachment.

                      Comment


                        #12
                        Ultra, I think I found the cause. I have a attachment filename/path called X:\CameraFTPServer\entrance\entrancelowres20140204_144609.m4 v

                        If I rename entrancelowres20140204_144609.m4v to just e.m4v, it sends fine. Seems like UltraSMTP3 has an attachment filename length limitation. Can you check? Thanks

                        Comment


                          #13
                          Hello madmax. Thank you for your patience with this issue. I was able to duplicate and resolve the issue caused by long filenames. I am uploading UltraSMTP3 HSPI version 3.0.5160.19961 that fixes this issue.

                          Regards,
                          Ultrajones
                          Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

                          Comment


                            #14
                            Thanks Ultra! Just downloaded and tested. So far, so good!

                            Comment


                              #15
                              OK Ultra, I have another potential bug for you. If you put a Colon in the subject line - it truncates the colon and everything after it.

                              Subject = "Re: This is a test"
                              even
                              Subject = "Re" + Chr(58) + " This is a test"

                              Results in an email with Subject of just "Re"
                              hs.SendEmail sends the correct subject.

                              Comment

                              Working...
                              X