Control Home Via Email or SMS for Dummies

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
James D
Senior Member
Posts: 133
Joined: Wed Jun 06, 2007 3:30 pm
Location: Baja California

Control Home Via Email or SMS for Dummies

Post by James D »

I want to first thank all on the forum that helped me to get this feature to work. Especially Mr. Olser. I can now send my home SMS messages via my cell phone or email and have my home execute selected tasks and give me status request back to my cell phone, and verifies me after the tasks are complete. Really cool to me. Below are the steps I used to get my system to work and it has been working seamlessly for a week now.

1. Set up an email account that you are strictly going to use for your HB server and nothing else. ( Made a Comcast account)
2. Download OstroSoft Pop Component 2.4.2 (Component Zip and Exe) and Download OstroSoft SMTP Component 6.4.5 (Component Zip and Exe) from the OstroSoft.com Website.
(Pop is the Incoming Messages & SMTP is Outgoing Messages)
3. Extract both Zip files for Pop and SMTP component
4. Put OSPOP3.dll and OSSMTP.dll in the windows/system directory
5. ClickStartRun “regsvr32 OSPOP3.dll”
6. ClickStartRun “regsvr32 OSSMTP.dll”
7. Execute both Pop3_Component.exe and SMTP_Component.exe
8. Take the POP script Below:

'VBScript sample for OstroSoft POP3 Component
'written by Igor Ostrovsky (OstroSoft)
'
'this script establishes POP3 session, retrieves mailbox stats
'and save them to the file, retrieves messages and save them in
'.EML format, then closes the session
'
'Permanent URL for this project is
'http://www.ostrosoft.com/pop3_component ... script.zip
'
'For more information about OstroSoft POP3 Component go to
'http://www.ostrosoft.com/pop3_component.asp
'
'OstroSoft POP3 Component is available for download at
'http://www.ostrosoft.com/download/pop3_component.zip
'
'Questions, suggestions, comments - email to [email protected]
'or submit a form at http://www.ostrosoft.com/contact.asp

Option Explicit

Dim oPOP3 'As OSPOP3.Session
Set oPOP3 = CreateObject("OSPOP3.Session")
oPOP3.RaiseError = True

If oPOP3.OpenPOP3("pop.comcast.net", 110, "[email protected]", "Password") Then
Dim oMessageList 'As New Collection
Dim oMLE 'As MessageListEntry
Dim oMessage 'As Message

Set oMessageList = oPOP3.GetMessageList
For Each oMLE In oMessageList
Set oMessage = oPOP3.GetMessage(oMLE.ID)
Call SetPropertyValue("EMAIL POP.RetrievedEmailSubject", oMessage.Subject) 'Put the email subject into a property
Set oMessage = Nothing
Call oPOP3.DeleteMessage(oMLE.ID)
Sleep(250)
Next
Set oMessageList = Nothing
oPOP3.ClosePOP3
End If
Set oPOP3 = Nothing


9. And save it as EmailPOP.vbs
(Of course fill in your POP server for your ISP, their port number, the email address you set up for your HB server, and your Password)

10. Take the SMTP script Below:

'VBScript sample for OstroSoft SMTP Component
'written by Igor Ostrovsky (OstroSoft)
'
'Permanent URL for this project is
'http://www.ostrosoft.com/smtp_component ... script.asp
'
'For more information about OstroSoft SMTP Component go to
'http://www.ostrosoft.com/smtp_component.asp
'
'OstroSoft SMTP Component is available for download at
'http://www.ostrosoft.com/download/smtp_component.zip
'
'Questions, suggestions, comments - email to [email protected]
'or submit a form at http://www.ostrosoft.com/contact.asp

Option Explicit

Dim oSMTP 'As OSSMTP.SMTPSession

Set oSMTP = CreateObject("OSSMTP.SMTPSession")

oSMTP.Server = "smtp.comcast.net" 'SMTP server name or IP address
oSMTP.Port = 25
oSMTP.MailFrom = "[email protected]" 'sender e-mail address
oSMTP.SendTo = GetPropertyValue("EMAIL VERIFICATION.Mail Destination") 'recipient e-mail address
oSMTP.AuthenticationType = 2 '0 = AuthNone, 1 = AuthPOP, 2 = AuthLogin, 3 = AuthPlain
oSMTP.Username = "xxxxxxxx" 'name for mailserver authentication
oSMTP.Password= "xxxxxxx" 'password for mailserver authentication
oSMTP.MessageSubject = GetPropertyValue("EMAIL VERIFICATION.MySubject") 'message subject or use GetPropertyValue(".MySubject") to retrieve a property from HB
oSMTP.MessageText = GetPropertyValue("EMAIL VERIFICATION.MyText") 'message text or use GetPropertyValue(".MyText") to retrieve a property from HB
oSMTP.RaiseError = True

oSMTP.SendEmail

Set oSMTP = Nothing

11. And save it as EmailSMTPSender.vbs
(Of course fill in your SMTP server for your ISP, their port number, the Username, and your Password)


12. In HB create 2 New Script devices
(Call One "EMAIL POP" and the Other "EMAIL VERIFICATION")
13. Associate the correct script to the correct device.
(EMAIL POP with EmailPOP.vbs and EMAIL VERIFICATION with EmailSMTPSender.vbs)
14. Right click on the EMAIL POP deviceAdd propertyUser Definable Alpha Property
(Description must be called “RetrievedEmailSubject”) (This triggers whatever task you want it to execute in HB)
15. Right click on EMAIL VERIFICATIONAdd propertyAlpha 1, Alpha 2, Alpha 3 or whatever
(Alpha 1 is called “Mail Destination”, Alpha 2 is called “MySubject”, Alpha 3 is called “MyText”)
16. Now you can have a HB task read the subject on the "EMAIL POP.RetrievedEmailSubject" execute a task such as Outside lights ON then have the SMTP send a message to your Cell phone Such as Outside light are on and so on.


For those that want a shortcut and want to be lazy ;-p and that do not want to do the HB part of this procedure I have an export for HB that can be imported. I send messages from my job to my HB server to give me status of different things in my house. I also have it send verification to my work email, too. I am try to incorporate my alarm system into the equation too. But that is another story. You also want to turn "EMAIL POP.State" to Running at startup. The task in the export file check email every 3 minutes. “Happy Tinkering”
Attachments
EmailHouseControls.hbx
(2.49 KiB) Downloaded 224 times
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Post by Richard Naninck »

James,

Why didn't you use the standard HouseBot EMail Sender Device to do the verification. I use it to email myself when the alarm has been triggered and it works perfectly. I use the same Pop3 component for receiving mail since HB doesn't have that native.
James D
Senior Member
Posts: 133
Joined: Wed Jun 06, 2007 3:30 pm
Location: Baja California

Post by James D »

The email sender does not work with on my Comcast Network (from my Tests). I can use it on a Bellsouth Network which I used to test my HB. At work I use the Bellsouth network T1 Network. My Home is on the Comcast network (where my server is) of course. The bellsouth network work will port 25, which the Email Sender uses. But Comcast uses port 110, which the Email Sender does not use. But I might have done something wrong, I have been known to do that. But very rare. LOL

I like the flexiblity of the OstroSoft because I can change the ISP ports and put in my password that my account requires. I could not change the ports from the email SMTP Sender and place my password. Unless I read the "Help" wrong or incompletely.
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Post by Richard Naninck »

I figured that port 110 is always used for receiving mail and port 25 is used for smtp. I don't understand how some system would use the standard pop3 port 110 for smtp purposes.SMTP is standard on 25.

Anyways, it is working for you so that is a good thing however I do feel something was wrong during your tests. But then again, if your tests were OK on one account, but not on the other than something must be wrong. Maybe a firewall thing or even the fact that your provider kills port 25 to prevent your account from being used for spamming.
James D
Senior Member
Posts: 133
Joined: Wed Jun 06, 2007 3:30 pm
Location: Baja California

Post by James D »

Your right Richard, 110 is for the Pop (incoming) Emails. I was going off the top of my head. Which is not a good thing to do. I think my problem lies on the Password Authentication. But then it should not work on the Bellsouth Network if that is the case. I do not know. I am still tinkering around with the Email Smtp Sender.
sundodger
Member
Posts: 80
Joined: Thu Sep 11, 2008 11:17 am

Re: Control Home Via Email or SMS for Dummies

Post by sundodger »

trying to get this working. the for dummies bit attracted me.
Get the following error when the device runs.
source ospop3
file c:\Program Files\Housebot\Config\Scripts\Emailpop.vbs line 26 char 0
error 0 pop3 connection failed timeout exceeded.
any genius have a fix or nudge in the right direction.
thanks Mark..
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Re: Control Home Via Email or SMS for Dummies

Post by Osler »

Can you post your code?

What email service are you trying to access?

Osler
sundodger
Member
Posts: 80
Joined: Thu Sep 11, 2008 11:17 am

Re: Control Home Via Email or SMS for Dummies

Post by sundodger »

have set up a gmail pop account. used the code above. copy and paste. edited the email address port number and password. gmail says port 995 which i have done.
just to be sure code below

'VBScript sample for OstroSoft POP3 Component
'written by Igor Ostrovsky (OstroSoft)
'
'this script establishes POP3 session, retrieves mailbox stats
'and save them to the file, retrieves messages and save them in
'.EML format, then closes the session
'
'Permanent URL for this project is
'http://www.ostrosoft.com/pop3_component ... script.zip
'
'For more information about OstroSoft POP3 Component go to
'http://www.ostrosoft.com/pop3_component.asp
'
'OstroSoft POP3 Component is available for download at
'http://www.ostrosoft.com/download/pop3_component.zip
'
'Questions, suggestions, comments - email to [email protected]
'or submit a form at http://www.ostrosoft.com/contact.asp

Option Explicit

Dim oPOP3 'As OSPOP3.Session
Set oPOP3 = CreateObject("OSPOP3.Session")
oPOP3.RaiseError = True

If oPOP3.OpenPOP3("pop.gmail.com", 995, "*********@gmail.com", "*********") Then
Dim oMessageList 'As New Collection
Dim oMLE 'As MessageListEntry
Dim oMessage 'As Message

Set oMessageList = oPOP3.GetMessageList
For Each oMLE In oMessageList
Set oMessage = oPOP3.GetMessage(oMLE.ID)
Call SetPropertyValue("EMAIL POP.RetrievedEmailSubject", oMessage.Subject) 'Put the email subject into a property
Set oMessage = Nothing
Call oPOP3.DeleteMessage(oMLE.ID)
Sleep(250)
Next
Set oMessageList = Nothing
oPOP3.ClosePOP3
End If
Set oPOP3 = Nothing
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Re: Control Home Via Email or SMS for Dummies

Post by Osler »

gmail, AOL, hotmail...none will work with the ostrosoft component due to a lack of SSL support (see link). In order to get this to work you will need to set up an email account via your ISP. Most offer more than one email account with the subscription.

http://www.ostrosoft.com/forum/forum_posts.asp?TID=227

NOTE: Yahoo no longer works with the component, either.

Osler
sundodger
Member
Posts: 80
Joined: Thu Sep 11, 2008 11:17 am

Re: Control Home Via Email or SMS for Dummies

Post by sundodger »

still with the same error despite changing all settings to one of my own mail addresses as a test. (no ssl)
anything else it could be based on the error generated.
Mark..
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Re: Control Home Via Email or SMS for Dummies

Post by Osler »

The code works just fine for me accessing a Road Runner account.

Make sure you have the POP server set correctly. Ensure the port is set to 110. Make sure you don't have a firewall that is preventing the script from working. Make sure that the account you are trying to access is POP as opposed to IMAP.

Osler
James D
Senior Member
Posts: 133
Joined: Wed Jun 06, 2007 3:30 pm
Location: Baja California

Re: Control Home Via Email or SMS for Dummies

Post by James D »

I have currently updated my pop3 device to the new POP3 device embedded into HouseBot 2.3.2

So far it has been working out well. I only had one little problem with it. Under the "Mail Action" property there are 3 options:
Get Mail
Get Message
Delete Message

When I used the embedded "Check Mail Timer" under the POP3 device to control the auto time span to check my home's email, I would come back home to HB having a lot of errors.
But I found that if I use a simple "delay" task to execute the "Get Mail" command under the "Mail Action" in my POP3 device it works great.

The problem on my POP3 came from the other feature on the "Get Mail" :
Get Message
Delete Message
when the embedded "Check Mail Timer" would execute.

But mine has been working good with my Comcast account.

Hope this help others.
sundodger
Member
Posts: 80
Joined: Thu Sep 11, 2008 11:17 am

Re: Control Home Via Email or SMS for Dummies

Post by sundodger »

afraid i am nearly at a loss on this one. can collect mail to this address via outlook. all settings the same in the script.
firewall seems to be ok. housebot in exceptions list.Or should i add something else?
same error.
James D i dont have the pop device listed in devices on V3
Oh Well...
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Re: Control Home Via Email or SMS for Dummies

Post by Osler »

You will need to reinstall HB and select the mail device during installation.

Osler
sundodger
Member
Posts: 80
Joined: Thu Sep 11, 2008 11:17 am

Re: Control Home Via Email or SMS for Dummies

Post by sundodger »

ok if i backup my config file will that allow me to restore everything?
Mark...
Post Reply