Plugin: Fake SMTP Server
Launch Data (ActiveX
Classname):
PH_SMTPServer.phsmtpserver
Initialization Data:
A full path and filename to the PH_SMTPServer ini
file. A base configuration INI file can be found in the plugins directory
at c:\powerhome\plugins\smtpserver.ini. Details on how to configure the INI are provided
below.
This plugin emulates an actual SMTP (Simple
Mail Transport Protocol) server but does NOT send email on its own and instead
fires triggers within PowerHome when applications attempt to send email through
the plugin. This is useful for interfacing with software and hardware that
doesnt provide another viable interface for communicating with PowerHome but
does provide for sending SMTP email messages. You can then configure the
software/hardware to use this plugin as the SMTP
server so PowerHome can be notified of events. The data that is sent to
the PowerHome triggers can then be used to construct and send an actual
email using PowerHome internal function as well as performing other desired actions.
INI File
Configuration:
The base configuration INI
file contents will appear like this:
[setup]
ip=10.0.2.15
port=25
emailcount=1
[email_1]
address=dhoward@myx10.com
subjectcount=2
subject_1=test
subject_2=
In the setup section, set the
IP parameter to the IP of the machine that PowerHome (and the plugin) is running
on. This will be the IP you'll configure the remote hardware/software to point
to as the SMTP server. Set the Port to the value you wish the SMTP server to
listen to. The default port for SMTP traffic is 25.
The plugin works by comparing
the "To Address" and the "Subject" to the values in the INI file and looking for
matches. The remote hardware/software that is attempting to send email will
provide these values to the SMTP server. You can distinguish between multiple
different software/hardware devices attempting to send email by the To Address
and Subject you configure them to use. If you have multiple different email
accounts that SMTP will attempt to send to, specifiy the total number of unique
addresses in the [setup]emailcount parameter.
For each email address you
specified in the "emailcount" parameter, you'll have a corresponding [email_?]
section. If your emailcount parameter is set to 2, then you'll have an [email_1]
and [email_2] section. With each section, you'll set the "address" parameter to
the email address you wish to monitor for.
Within an email section, you
define your subjects. Set the "subjectcount" parameter to the total number of
subjects you want to match on. If you set the subjectcount parameter to 3,
you'll have 3 "subject_?" parameters beneath it: subject_1, subject_2, and
subject_3. You'll set the subject_? parameters to the subject data you wish to
match on.
When an email is attempted to
be sent through the SMTP server plugin, it will first gather the full email
information (To Address, From Address, Subject, Email Body). It will then
sequentially try to do an exact match on the "To Address" to the address
parameter in each [email_?] section starting with the first section and
continuing. When a match is found, the plugin will then loop through and
try to match the subject. This match is done by taking the "subject_?"
text checking to see if it is contained within the Subject that was sent by
SMTP. If the SMTP subject is "Alert: Motion detected!" then a subject_?
parameter set to "Motion" (or "Alert" or "Motion detected", etc) will
result in a match. Once a match is found, a PowerHome Generic Plugin
trigger will then be executed. Once a match is found and the trigger is
sent, then the loop and comparison will be terminated and the plugin will
wait for the next SMTP email. If you wish to match on ANY subject, leave
the "subject_?" parameter blank.
Controller Commands
supported:
None
Generic Plugin triggers fired:
When an SMTP email / subject
combination is matched, a Generic Plugin trigger will be fired with the "Trigger
ID Number" column "Command ?" matching the [email_?] number that was matched.
The "Trigger Value" column "Option ?" will match the "subject_?" number that was
matched. When the trigger is fired, the [TEMP5] system variable will
contain the IP of the client sending the SMTP followed by a tab followed by
the From Address followed by a tab followed by the To Address. The [TEMP10]
variable will contain the SMTP email message body.