Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to send text messages to my phone with VFP 3

Status
Not open for further replies.

dkean4

Programmer
Feb 15, 2015
282
US
Hi guys,
Does anyone have some code for sending text messages directly to a phone, like my own phone, to start with...

Dennis Kean


Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
Yo can't do this using native VFP. You will need to sign up to a gateway or an API - which will usually involve some cost. You will probably also have to purchase a dedicated phone number to use for the service (for the outgoing SMS, not for the phone that receives the messages).

There are several providers and gateways offering this service. I am not able to recommend any one in particular, but here is an uo-to-date list with some reviews and tutorials: List of Top SMS APIs to Send Text Messages.

Once you are up and running with this, you should be able to send messages to any phone, anywhere in the world. However, there might be some restrictions on the countries from which you can send the messages.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
You can use Outlook to send an sms message (sorry to disagree with you Mike)
If you know the provider you can send an e-mail for example phone number of the cell phone you want to reach and the provider's extension like 5553331212@fido.ca and if the recipient's phone allows this type of message it will reach the recipient.
Each phone owners the provider creates an email address with the phone number as the first part of the address.

The link above shows you how to use most of Microsoft office's products to send emails or SMS messages.
Of course you would need to automate Outlook to make this work the way you want.

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
(sorry to disagree with you Mike)

On the contrary, Mike, I'm delighted to learn something new.

In your Atoutfox article, you said, « Il s'agit seulement de connaitre le fournisseur du téléphone mobile que vous voulez rejoindre. » I assume that's what you place after the @ in the email address? So, in your example, fido is the name of your provider (located in Canada, of course)?

But how would you know what to place after the @ for any other provider?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike
I did a search on 'rogers email extension' for example (my provider) it returns me this

'Your email address will be your 10-digit Rogers wireless phone number followed by @pcs.rogers.com. Example: [area code and phone number]@pcs.rogers.com " most provider will give you this information
They are not all the same format as you can see.





If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks, Mike. I tried your suggestion, only to find several sources stating that my provider (which is called Three) doesn't provide this facility and probably never will, although most other UK providers do.

I'm not bothered. I just wanted to try it out, more out of curiosity.

I did, however find this:

List Of Email-To-SMS Addresses

which seems to be what Dennis will need.

In fact - as you mentioned in your article - you don't have to use Outlook Automation to send the message. Any method of automatically sending email should work, even something as simple as ShellExecute() a mailto: link. Contrary to my first post, above, it should be fairly easy.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
There is also Blat, CDOSYS etc.



If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi, again guys. I tried many things from your suggestions.

I took Mike Gagnon's suggestion

&& Solution #1 Avec Microsoft Word
&& Deux lignes de code !
o = CREATEOBJECT('word.application')
o.Documents.Add("Normal",.f.,1)
o.visible = .T.

Alors, ca ne marche pas Monsieur... I speak French, Mike...[peace]
That did not do much for me, although I liked that idea before trying anything else.

So I added another line and the new Doc came up, inside of MS WORD. I was not able to weed out a complementary line of code for that, other than perhaps insert _cliptext into the New doc.

Next, I tried this and I was excited, for a while. This invokes OUTLOOK and I tried to install a Google account into it, but for some reason it simply will not work with IMAP in google, even though Google says that it will install easily...

DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, STRING cAction, STRING cFileName, ;
STRING cParams, STRING cDir, INTEGER nShowWin

lcMail = "mailto:zzzzzz@gmail.com"+ ;
"?CC= zzzzzz@gmail.com&Subject= Rencontre"+ ;
"&Body= Veuillez me rejoindre pour diner."
ShellExecute(0,"open",lcMail,"","",1)

Everything worked like a charm except setting up a Google account in Outlook.

Finally, I found a way to load Google's Voice feature for Calling phone numbers and Sending Messages. That works great,
But trying to navigate inside of Google Voice is kludgey! Of course, you can send images, videos, smileys, long texts etc... It supports MMS.

However, you have to load the parameters by hand every time you send a message.

- Initiate a new message
- Select user from list
- Enter the message
- Press Send >

But Google says that it will stop message sending this way, soon. In fact, the date they set was August 1 this month... But it is still working. So, that is a bust too... But it is very easy to set the code to access the Google Voice page.

Code:
 lcURL = "[URL unfurl="true"]https://voice.google.com/u/0/messages?itemId=draft-9F5D1ED8-59BD-4D2A-B0FA-AD073C0DFDB3"[/URL]
ShellExecute(0,'open','chrome.exe',m.lcURL,'',1)

A hearty thanks to all participants. Mike Lewis, Mike Gagnon, and Bilch.

The only thing that has a chance left is Mike Gagnon's code for Word if I could get the rest of the code. Maybe some Macro could be set up or is there code that I did not see in that long list of variant code...???


Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
Dennis,

Essentially, what Mike G. is saying is that you can use the standard email system to send SMS messages to mobile phones (on most, but not all, networks). You just need to know the email address to send to.

There are many ways of programmatically sending emails from VFP. Using ShellExecute() with a mailto: link is one of them, but it might not be ideal, as basically all it does is to open an email composing window in your default email client. My preference is to use CDO, as described (by Mike G) in faq184-4969. This is independent of the email client and the email provider. There are other methods as well.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Dennis
[pre]o = CREATEOBJECT('word.application')
lodoc=o.Documents.Add("Normal",.f.,1)
lodoc.sendmail()
o.visible = .T.
[/pre]



If you want to get the best response to a question, please check out FAQ184-2483 first.
 
This is what I used to send text messages through our outlook server. It worked like a charm.

Code:
lto=[1234567890@vtext.com;1234567890@vtext.com] && USA Verizon text
o=Createobject([outlook.application])
oitem=o.createitem(0)
oitem.subject=[This PO's will need to be looked at]
oitem.Importance=2
oitem.To=lto
oitem.Attachments.Add(lcfile)
TEXT TO lbody NOSHOW
	These Po's need to be looked at.
ENDTEXT
oitem.body=lbody+Chr(13)+Chr(10)+Chr(13)+Chr(10)+Sys(16)
oitem.Send
o=.Null.
 
One point to keep in mind with all these techniques is that you need to know your recipient's phone provider. That's not the sort of information that would normally be collected from a client, employee, etc.

I assume that the sort of gateway that I mentioned at the start of this thread is intended to overcome that problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike Lewis
Do I need to contact my phone telephone service supplier? Or is there a list of their URL somewhere on the WEB? The list you supplied does not have Consumer Cellular...


Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
Dennis,

If you can't find the address anywhere by searching for it, then maybe contacting your provider will be the best bet. But there is no guarantee that they provide this service. My own provider doesn't.

I appreaciate that for now you just want to try sending a message to your own phone. But keep in mind that, if you are sending messages more generally, you will need to know the addresses of all your recipients' providers, which might be a tall order.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike Lewis,

I appreciate your thoroughness immensely, Mike. You guys are a veritable asset when I need help. The purpose of trying to implement this is to be able to convey alarm messages from my home alarm and controllers so I can know what is taking place when I am away. This way I can send back commands to override automation which is already working on a bunch of processes, like watering different parts of my garden, sending soil humidity feedback, etc...

So, I am not trying to send messages to a bunch of other folks. Once I get Consumer Cellular's address it will be great...

Really appreciate your advice...

Regards,

Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top