New version : 0.92
Hi, All
A simple plugin for sending notification using your own SMTP(S) server.
I use a lot of informations/code previously published on this forum to create a plugin
[ul][li]SSL connexion to server[/li]
[li]Server Authentification[/li]
[li]Dynamic message body that can include value comming from other plugin variable[/li]
[li]Setup GUI[/li]
[li]Multiple eMail recipient (TODO)[/li]
[li]CC/BCC (TODO)[/li]
[li]Add serial of sending Unit to subject[/li][/ul]
Tested only with UI5 (1.5.408)
VERSION HISTORY
[ul][li]0.5 Initial public release[/li]
[li]0.6 Minor UI correction / Add new option for adding Vera Serial number to Subject[/li]
[li]0.7 UI modification, add a setup Tab to simplify Setup[/li]
[li]0.8 Test / Debug Release not published[/li]
[li]0.9 UI Modification, Add Function to reset #Mail sent, BugFix [/li]
[li]0.92 BugFix, correct smtp syntax problem that block gmail usage, add ability to add sender name in action.[/li][/ul]
INSTALLATION
Automatic Installation version may be older due to validation Delay
Automatic
https://apps.mios.com/plugin.php?id=2498
Manual
Upload the plugin files :
- In the Apps section open Develop Apps >> Luup Files and upload all the files you downloaded. check the Restart Luup after upload checkbox and click GO.
Create the SMTP Interface Device:
- Open Create Device.
- In the UpnpDevFilename input box enter D_SmtpNotification.xml
- In the Upnp Implementation Filename input box enter I_SmtpNotification.xml
- In the Description input box enter a name for the panel device, e.g. My eMail Notification.
- Click Create device.
- Close this window and Save.
Configuration
Go to the SMTP Tab and Fill the required parameters. Parameters in bold are mandatory.
Advanced Configuration
In the device advanced tab, you can find the following parameters (See screenshot)
[ul][li]Last Error message with readable time[/li]
[li]Your SMTP server address or name[/li]
[li]SMTP server port (Note SMTPS always use port 465)[/li]
[li]Add Vera serial to subject[/li]
[li]Activate server authentication[/li]
[li]User name used for authentication[/li]
[li]Password used for authentication[/li]
[li]Activate SSL (SMTPS)[/li]
[li]Address used for sending eMail[/li]
[li]Description (name) used for sending eMail[/li]
[li]Number of mail correctly sent[/li]
[li]Timestamp of last Error[/li]
[li]Timestamp of last successful send[/li]
[li]Debug Flag[/li][/ul]
- Close this window and Save then Reload Luup
[size=10pt]USAGE IN SCENE[/size]
SendEmail action
[ul][li]Subject[/li]
[li]Recipient eMail(Only one for now)[/li]
[li]Recipient Name[/li]
[li]Message[/li][/ul]
SendDynamicEmail action
The idea behind that is to be able to send an eMail with a variable part coming from another device value e.g. :
Where the value 18 is coming from other device,. You can see below how to setup this dynamic message body
Warning Only ([b]18[/b]%) of battery remaining[table]
[tr]
[td]PreMessage ==>[/td]
[td]“Warning Only (”[/td]
[/tr]
[tr]
[td]DeviceID ==>[/td]
[td]Your device number[/td]
[/tr]
[tr]
[td]Devicetype =>[/td]
[td]“urn:micasaverde-com:serviceId:HaDevice1”[/td]
[/tr]
[tr]
[td]VariableName =>[/td]
[td]“BatteryLevel”[/td]
[/tr]
[tr]
[td]PostMessage =>[/td]
[td]“%) of battery remaining”[/td]
[/tr]
[/table]
[ul][li]Subject[/li]
[li]Recipient eMail (Only one for now)[/li]
[li]Recipient Name[/li]
[li]PreMessage Beginning of message body[/li]
[li]PostMessage End of message body[/li]
[li]DeviceID Id of device used for variable part[/li]
[li]Devicetype Type of device used for variable part[/li]
[li]VariableName Variable of device used for variable part[/li][/ul]
ResetCount Action
Reset number of # message(s) sent
[size=10pt]USAGE IN CODE[/size]
Assuming that the Plugin was installed as Device 99, the following tests should work. Your installation will have a different Device number, please adjust accordingly.
luup.call_action("urn:upnp-org:serviceId:SmtpNotification1", "SendEmail", { Recipient_Name="Tony Stark", Recipient_eMail="tony@stark.com", Subject= "Title", Message="Message" }, 99)
luup.call_action("urn:upnp-org:serviceId:SmtpNotification1", "ResetCount",{}, 99)