Please login or register.

Login with username, password and session length
Pages: [1] 2

Author Topic: [TIP] Alternate Email Method If MyHouseOnline Email Won't Work For You  (Read 52877 times)

RebHawk

  • Full Member
  • ***
  • Helpful Post Rating: 6
  • Posts: 60

This seemed like the best place to put this.  If not, feel free to move it to the correct place.

Narrative:

Despite the help of those here, I have never been able to get email from MyHouseOnline or any other AHP email to work.  I tried to get it working for some time, but finally gave up and decided to send my email using VBScripts run by batch files which are in turn run by using a PC Command from AHP in my AHP macro.  An example would be my Den Door macro.  If I have my "ARMED AWAY" flag set and the den door DS10A is tripped, the macro sounds my power horns and emails me at my home account, office account, and cell phone.  My powerhorns are triggered by a powerflash module that is in turn triggered by a universal module.

Trigger Conditions:
ARMED AWAY Flag set (NOTE: NOT the same as OnAlert ARMED AWAY.  I use one of the 16 AHP Flags for this function)
Den Door DS10A tripped


Actions:

Powerhorns ON
Delay 2 seconds
Execute Windows Program:
     c:\wtmp\X10\email\Den-Door.bat

This batch file simply contains the line:
     c:\wtmp\X10\email\Den-Door.vbs

This batch file runs the following VBScript, which actually sends the email:

Set objEmail = CreateObject("CDO.Message")
objEmail.From = "xxx@xxx.com"
objEmail.To = "xxx@xxx.com, yyy@yyy.edu, ##########@vtext.com"
objEmail.Subject = "ALERT ALERT ALERT Den Door Open"
objEmail.Textbody = "DEN DOOR OPENED!!!"
objEmail.Send


The above VBScript is saved with a name like "Den-Door.vbs" as indicated above.

You can cut and paste the above macro, replacing xxx, yyy, and #### as necessary for your particular email addresses and/or cell phone text message addresses.  Then build a library of bat/vbs files, one pair for each particular email alert you wish to send.  The advantage of this method is that it doesn't rely at all on AHP, except for running the batch file, which AHP seems to have no problem doing.

One caveat, make CERTAIN you have word wrap turned OFF in your text editor when writing these vbs files.  The line most likely to get word-wrapped is the "objEmail.To =" line, so if you get an error when trying to run the scripts, make sure you don't have a word wrap problem.

Another advantage to this method is that you can do all your testing outside of AHP.  Simply go to the directory you have these files stored in and double-click the batch file.  Edit and repeat until you get it working (which shouldn't take long!).

To me this method is much more robust than the AHP methods. 

Regards,
--Lee

EDIT: Fixed typo in trigger command name (should be Den-Door.bat, not Den-Door.vbs)
EDIT: Clarified some details of the file names for the various scripts.
« Last Edit: March 09, 2008, 11:10:03 PM by RebHawk »
Logged

jtykal

  • Sr. Member
  • ****
  • Helpful Post Rating: 12
  • Posts: 86
  • It was working fine yesterday...
    • Casa Bella - Vacation Condo in Fort Myers, FL

Lee -- I've been planning to do something like this when I had a few cycles to spare. Thanks for saving me the time with this very helpful script! Can't wait to try it out!
Logged
AHP-CM15A(ext.ant)-SmartMacros-OnAlert-DoorMonitor(custom)-Win7

RebHawk

  • Full Member
  • ***
  • Helpful Post Rating: 6
  • Posts: 60

Glad I could help.  Note the correction I made to the trigger command.  Should have referred to the .bat file, not the .vbs file.  Also, for those not familiar with VBScript, it is built-in to Windows.  No need for extra software :D

Cheers,
--Lee
Logged

KDR

  • Hero Member
  • *****
  • Helpful Post Rating: 53
  • Posts: 758
    • Home Automation Chat

Nice tip RedHawk, a  good alternative to get that email sent out. Gets a helpful from me.

----------------KDR
Logged
Note: "Guests" may read the X10 forum , but you must register to post!

When I'm online you can find me in the Home Automation Chat Room!

chuck

  • Jr. Member
  • **
  • Helpful Post Rating: 3
  • Posts: 12

Thanks.  I've used this code before, but was so hell-bent on making AHP email work I forgot about using it.  I tried it out and even dug out some old code I had, but it appears my new ISP (Verizon FIOS) blocks this kind of traffic.

I googled  "CreateObject("CDO.Message")" and found a very helpful site <<http://www.paulsadowski.com/WSH/cdo.htm>>  Here they have code for dealing with using your ISP's mail server passing it a username and password.  You will need to know your outgoing mail server info (same info you need to setup a mail client.

I hope this helps others in my situation.  I also hope the AHP developers will update their software to allow for email server configuration.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!

RebHawk  And chuck
You both get a helpful from me as many users will have to put both bits together to send!

RebHawk this Is the correct place for user created Macros! As jtykal pointed out
Quote
Thanks for saving me the time.....
this macro library is designed to save users time creating similar macros!
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

chuck

  • Jr. Member
  • **
  • Helpful Post Rating: 3
  • Posts: 12

Follow up question to the use of these macros and executing windows programs...  I realize the computer must be running in order for the macros to execute the programs on the computer, but does a users have to be logged into the machine and AHP GUI actively running, or does/can the AHP service execute these programs -- without the GUI?

I have AHP running on a Win2K server (who's primary function is my family web server).  Typically, no one is ever logged into the machine b/c everything has been running as a service.  However, I will have to change this model if AHP GUI client needs to be running on the console.

Please advise.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!

In order for the batch files to execute AHP need be running so looks like you'll need to reconfigure your Win2k machine! ;)
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

halcali

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 2

has anyone been able to get this code to work with gmail smtp?

i tried the following code and it didn't work.

----------------------------------------------------

Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM


Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "ALERT ALERT ALERT Den Door Open"
objMessage.From = "xxx@xxx.com"
objMessage.To = "xxx@xxx.com"
objMessage.Textbody = "DEN DOOR OPENED!!!"

'==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "yourusername@gmail.com"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465



'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send

---------------------------------------------------------------


what did i mess up?
Logged

me too

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 38

The below works for me everytime. 



Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Sent because x10 event happened " & Now()
objMessage.From = "emailaddress"
objMessage.To = "emailaddress"
objMessage.TextBody = "Someone by the front door " & Now()


'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "your server address"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send
strSoundFile = "C:\Windows\Media\Notify.wav"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "sndrec32 /play /close " & chr(34) & strSoundFile & chr(34)
objShell.Run strCommand, 0, True


Logged

JMac

  • Hero Member
  • *****
  • Helpful Post Rating: 23
  • Posts: 462
Re: [TIP] Alternate Email Method If MyHouseOnline Email Won't Work For You
« Reply #10 on: August 13, 2010, 12:34:17 AM »

I had been using VBS (and yahoo) for quite a while with no problems.  Then I realized that messages would take as long as 45 - 50 minutes before completion.  I switched to "gmail" setup and the message completion only took a few seconds.  Anybody know how come ?
Logged

Noam

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 51
  • Posts: 2818
Re: [TIP] Alternate Email Method If MyHouseOnline Email Won't Work For You
« Reply #11 on: August 13, 2010, 10:16:35 AM »

I have found that Yahoo mail can be slow (especially in the last few months) for no apparent reason.
Logged

JMac

  • Hero Member
  • *****
  • Helpful Post Rating: 23
  • Posts: 462
Re: [TIP] Alternate Email Method If MyHouseOnline Email Won't Work For You
« Reply #12 on: August 13, 2010, 10:28:07 AM »

Thanks, Noam.  For awhile I thought I was going to have to dig deeper into my setup to locate the problem.
Logged

pconroy

  • Hero Member
  • *****
  • Helpful Post Rating: 9
  • Posts: 294
Re: [TIP] Alternate Email Method If MyHouseOnline Email Won't Work For You
« Reply #13 on: August 13, 2010, 10:59:25 AM »

I have found that Yahoo mail can be slow (especially in the last few months) for no apparent reason.

i don't want to kick a company when it's down - but a few of the other Yahoo services I still use - like their groups - appears to have slid downhill dramatically.

Logged

Noam

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 51
  • Posts: 2818
Re: [TIP] Alternate Email Method If MyHouseOnline Email Won't Work For You
« Reply #14 on: August 13, 2010, 12:39:33 PM »

I'm happy to keep kicking - let them fight back (fix the problems)!

They BROKE Blackberry synchronization for nearly two months earlier this summer.
They BROKE my calendar (by "upgrading" it to the new Beta calendar), so it can no longer sync with my Blackberry.

I've been using them as my primary e-mail address for over 10 years, so it is really hard for me to just dump them.
Logged
Pages: [1] 2
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.