Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Macros, Scripts, and Formulas Repository
 PowerHome Messageboard : PowerHome Macros, Scripts, and Formulas Repository
Subject Topic: MACRO: Send POP3 email Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
nadler
Super User
Super User


Joined: February 25 2006
Location: United States
Online Status: Offline
Posts: 354
Posted: December 21 2006 at 22:29 | IP Logged Quote nadler

I use this macro to send me an email when a wireless x-10 sensor is triggered in my garage. The macro polls the insteon switches in the house for their status and then sends an email indicating that there has been movement in the garage, the date and time and which lights are on in the house.

If you use this macro you would change the email information as well as the names of the various insteon devices. The help file explanation of the ph_sendsmtpmail function is included at the bottom of this message.

The macro is 1 line which is just a big formula.

insert into macroheader values ('SEND EMAIL','EMAIL STATUS TO NOEL',0,0,1);
insert into macrodetail values ('SEND EMAIL',1,38,'',NULL,'ph_sendsmtpemail("mail.optonline.net",2 5,"noel@geezeremail.com","noel@geezernetwork.com","Garage Movement","Noel, I am reporting from home. There has been movement in the garage."+today()+". The following devices are on: "+if (ph_getinsteonstat( "COMPUTER LIGHT1")=2,"The computer light is on. "," ")+if (ph_getinsteonstat( "GUEST ROOM")=2,"The Guest Room Light is on. "," ")+if (ph_getinsteonstat( "ADAMS ROOM")=2,"Adam''s Room light is on. "," ")+if (ph_getinsteonstat( "BATHROOM UPSTAIRS")=2,"The upstairs bathroom light is on "," ")+if (ph_getinsteonstat( "FRONT OUTSIDE")=2,"The front outside light is on. "," ")+if (ph_getinsteonstat( "GARAGE OUTSIDE SLAVE")=2,"The Garage Outside light is on. "," ")+if (ph_getinsteonstat( "MASTERBEDROOM")=2,"The Master Bedroom light is on. "," ")+if (ph_getinsteonstat( "KITCHEN CABINETS")=2,"The KITCHEN CABINET light is on. "," ")+if (ph_getinsteonstat( "JORDANS ROOM")=2,"JORDAN''S ROOM light is on. "," ") )',0,'');

To help with the syntax of the ph_sendsmtpmail function here is the help file information for that function:

Description
Sends an email message using SMTP.
Syntax
ph_sendsmtpemail ( s, n, s, s, s, s )
Argument Description
s The IP or DSN of the SMTP server.
n The port of the SMTP server. This is typically port 25.
s The email address you are sending the email from. Most SMTP servers require you to enter a valid email address registered on the SMTP server. You may optionally enter a userid and password if your SMTP server requires authentication.
s The email addresses you wish to send a message to. Separate multiple email addresses with commas.
s The subject of the email.
s The text of the email message.

Return value
Integer. Returns 0 if successful. Any other value signifies an error occurred. You can specify multiple recipients by separating the email addresses with commas.
Usage
Use this function to send email using raw SMTP rather than the MAPI interface that the ph_sendemail function uses. If an error occurs while sending using SMTP, the PowerHome system will not hang like it does when sending using MAPI.

If your SMTP server requires authentication, then supply the userid and password in the third parameter after the "From" email address. Separate the "from" email address, userid, and password with commas (do not add spaces).
Back to Top View nadler's Profile Search for other posts by nadler
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: December 28 2006 at 10:52 | IP Logged Quote krommetje

Not to be a nitpicker (is that the way to write it?) but POP3 is for receiving! SMTP is for sending ...

Peter

I'll try your script on my mailservers ... be back with feedback!

Peter
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
nadler
Super User
Super User


Joined: February 25 2006
Location: United States
Online Status: Offline
Posts: 354
Posted: December 28 2006 at 13:07 | IP Logged Quote nadler

You are correct, my mistake. What I was trying to indicate was that you donn't need a MAPI email client for this to work.
Back to Top View nadler's Profile Search for other posts by nadler
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: January 10 2007 at 10:26 | IP Logged Quote krommetje

Tell me something... (now you are in my alley ...)

you have accounted for almost anything, but have you taken into account the fact that there are 2 ports nowadays for smtp?

25 is the regular Port
587 is the 2nd port called SMTP-submit

Peter

Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje'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