Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Problem Sending SMS Messages Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
renard
Groupie
Groupie
Avatar

Joined: November 01 2009
Location: United States
Online Status: Offline
Posts: 72
Posted: October 21 2017 at 12:41 | IP Logged Quote renard

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.

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 View renard's Profile Search for other posts by renard
 
renard
Groupie
Groupie
Avatar

Joined: November 01 2009
Location: United States
Online Status: Offline
Posts: 72
Posted: October 21 2017 at 12:44 | IP Logged Quote renard

Sorry - In the message, not the Global variables, I misspelled SMSSMTP.

__________________
Terry
Back to Top View renard's Profile Search for other posts by renard
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: November 09 2017 at 13:52 | IP Logged Quote dhoward

Terry,

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 View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
renard
Groupie
Groupie
Avatar

Joined: November 01 2009
Location: United States
Online Status: Offline
Posts: 72
Posted: November 09 2017 at 15:54 | IP Logged Quote renard

Dave,

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 View renard's Profile Search for other posts by renard
 
gg102
Senior Member
Senior Member


Joined: January 29 2013
Location: United States
Online Status: Offline
Posts: 245
Posted: November 09 2017 at 16:00 | IP Logged Quote gg102

Just an observation:

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 View gg102's Profile Search for other posts by gg102
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: November 10 2017 at 17:19 | IP Logged Quote dhoward

Terry,

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 View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
renard
Groupie
Groupie
Avatar

Joined: November 01 2009
Location: United States
Online Status: Offline
Posts: 72
Posted: November 17 2017 at 09:47 | IP Logged Quote renard

Dave,

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 View renard's Profile Search for other posts by renard
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: November 17 2017 at 10:27 | IP Logged Quote dhoward

Terry,

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 View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: November 17 2017 at 16:15 | IP Logged Quote dhoward

Terry,

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 View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum