| Author |  | 
      
        | renard Groupie
 
  
  
 Joined: November 01 2009
 Location: United States
 Online Status: Offline
 Posts: 75
 | 
          I am trying generate SMS messages when Leak Sensors detect water.  I can generate email messages and just modified the function call to generate SMS per the ATT instructions.
           | Posted: October 21 2017 at 12:41 | IP Logged |   |  
           | 
 |  
 The function call is:
 
 ph_sendsmtpemail("{SMSSMTP}",25,"{SMSFROM}","{SMSTO}","{SMST ITLE}","{SMSMSG}")
 
 SMSSMPT = mail.dennisonla.com - same as works for email
 SMSFROM = 1205_Control@dennisonla.com - ditto
 SMSTO = 3104633475@txt.att.net - different from email
 SMSTITLE = PH Emergency Message - works/email
 SMSMSG = Leak Sensor in Entryway Reports Wet - ditto
 
 The Verify Function returns an error code of 9.  Substituting a normal email address and verify return 0 and message is sent.  Sending with the same parameters from a PC works perfectly.  BTW, PH has its own email address on our server: 1205_Control@dennisonla.com and we get routine emails from the system all day.  I want to have an emergency message facility using SMS.
 
 Ideas are appreciated.
 
 __________________
 Terry
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | renard Groupie
 
  
  
 Joined: November 01 2009
 Location: United States
 Online Status: Offline
 Posts: 75
 | 
          Sorry - In the message, not the Global variables, I misspelled SMSSMTP.
           | Posted: October 21 2017 at 12:44 | IP Logged |   |  
           | 
 |  
 __________________
 Terry
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Terry,
           | Posted: November 09 2017 at 13:52 | IP Logged |   |  
           | 
 |  
 The first thing I would try is using the ph_getglobal_s function for each global rather than using the variable substitution. Sometimes it just works better.
 
 If that doesnt do it, let me know and I'll dig into the function to try and see what might be wrong.
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | renard Groupie
 
  
  
 Joined: November 01 2009
 Location: United States
 Online Status: Offline
 Posts: 75
 | 
          Dave,
           | Posted: November 09 2017 at 15:54 | IP Logged |   |  
           | 
 |  
 I tried replacing the direct global variable substitution with:
 
 ph_sendsmtpemail(ph_getglobal_s("SMSSMTP"),25,ph_getglobal_s ("SMSFROM"),ph_getglobal_s("SMSTO"),ph_getglobal_s("SMSTITLE "),ph_getglobal_s("SMSMSG"))
 
 and still an error code of 9.  This exact code is also used to send email messages and it works fine.
 
 Also,
 
 I tried using literal strings for each parameter and still got the error message of 9.  It appears the error message 9 is either content-specific or it is reflecting some return from the server the function is talking to.
 
 Terry
 
 __________________
 Terry
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | gg102 Senior Member
 
  
 
 Joined: January 29 2013
 Location: United States
 Online Status: Offline
 Posts: 246
 | 
          Just an observation:
           | Posted: November 09 2017 at 16:00 | IP Logged |   |  
           | 
 |  
 I could be wrong here but it looks like you're using port 25.
 
 Most ISPs block port 25.
 
 Might look into this.
 
 Just a suggestion.
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Terry,
           | Posted: November 10 2017 at 17:19 | IP Logged |   |  
           | 
 |  
 I looked up the source and a return of 9 means its failing on the very last step...the actual sending of the email message. To get more
 information, try running the ph_getlasterrorstring() function immediately after the ph_sendsmtpemail function and see if we get any more
 details there.
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | renard Groupie
 
  
  
 Joined: November 01 2009
 Location: United States
 Online Status: Offline
 Posts: 75
 | 
          Dave,
           | Posted: November 17 2017 at 09:47 | IP Logged |   |  
           | 
 |  
 Message is not very informative:
 
 Undefined control error (0x00000000)
 
 Regarding a prior message, Port = 25 is fine.  That is what I use for everything.
 
 Using the same code but changing the 'to' variable to a regular email address returns 'SMTP Success' so message
 return is working properly.
 
 Is it possible that error 9 is triggered by a response from the email server itself?
 
 Terry
 
 __________________
 Terry
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Terry,
           | Posted: November 17 2017 at 10:27 | IP Logged |   |  
           | 
 |  
 That would be correct. Error 9 is at the last step of the SMTP function where it is communicating with the server to generate the email. So
 yes, it's a result of a response from the server. The problem though is that the getlasterrormessage should have given us a little more info
 as to what the problem is with the server.
 
 This sendsmtpemail function uses the Catalyst SMTP activex control. All I can guess is that the server is returning data that the control is
 not expecting. A search of the Catalyst forums is turning up a blank.
 
 I'll do some more research here to see what I can come up with and get back with you.
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Terry,
           | Posted: November 17 2017 at 16:15 | IP Logged |   |  
           | 
 |  
 Went through the sourcecode and cant find a way to get the Catalyst control to give me more info. Using your data declared in your first post,
 I recreated the formula on my system (I changed the mail server and mail from values) and it worked for me. You should be getting a text
 message assuming the number in the first post was real.
 
 I am in the midst of adding another way to send SMTP traffic using routines from C# and will include this in the next version so it may work
 better for you.
 
 I know sending to SMS works as I do it all the time in my system but it's a Tmobile number vs AT&T.
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  |