Use email to wake your PC, and so on.
Sent email with subject alive & ip & wake Ray Eldath's Desktop
:
And you will receive:
- Multi-commends email (email whose subject is multiple commends separate by
&
, likealive & ip & wake Ray Eldath's Desktop
) supported. - Useful commend handlers contained:
wake <TARGET NAME>
: sent magic package to target in order to wake target device.ip
: returns public IP address.alive|heartbeat
: test if server still alive.
- Support mainstream mail protocol (
POP3
,IMAP
,SMTP
). - Easy to expand.
- Decompression RELEASE file which downloaded here.
- Create file
config.json
under directoryEW.Email-VERSION/bin
. - Config
config.json
which describe in next part. - Execute file
EW.Email
(Linux) orEW.Email.bat
(Windows). - Star and Follow this project :-)
Following instructions are for Linux system. (Tested on Debian 8)
For Windows, just add EW.Email.bat
into your list of startup items.
- Download ew file and move it into
/etc/init.d
. (remember insudo
! ) - Use
chkconfig
to set it start automatically.
This part explains config file config.json
.
config.json
:
{
"update_frequency": 60, // Frequency of connect email server and handle email.
"daemon": true, // Use daemon mode. If on, log will outputs into temp file, not stdout.
"zone_id": "Asia/Shanghai", // Your zone id, used for zoned time. All available values see `https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html#SHORT_IDS`.
"permitted_addresses": [ // Emails from these addresses will be handled.
"[email protected]"
],
"email": {
"name": "Ray Eldath",
"address": "[email protected]", // Your email address, also used for login email server.
"password": "TestForTest@!%!", // Password of your email.
"sender": { // Config sender server.
"protocol": "SMTP", // Only support SMTP protocol yet.
"host": "smtp-mail.outlook.com", // Server host.
"port": 587, // Server port.
"transport_strategy": "SMTP_TLS" // Transport strategy, available values containes `SMTP_PLAIN` `SMTP_SSL` and `SMTP_TLS`. Default `SMTP_PLAIN`.
},
"receiver": {
"protocol": "IMAP", // Support IMAP and POP3 protocols.
"host": "imap-mail.outlook.com",
"port": 993,
"ssl": true // Use SSL or not. Default `false`.
}
},
"handler": { // Config for commend handler
"Wake": { // Config for handler:Wake.
"target": [
{
"name": "Ray Eldath's Laptop", // Name of this target. You should wake this device with email with subject `wake Ray Eldath's Laptop`.
"mac": "4C:CC:6A:30:C2:5A", // MAC of the device.
"ip": "192.168.0.8" // IP of the device.
}
]
}
},
"debug": false // Only for debug purpose.
}
This part describes how to add custom commend handler into EmailEverything.
- Created
class
under packageray.eldath.ew.handler
- Make this
class
implements Handler
- Let method
titleRegex
returns regex for email subject - Fill main processing in method
handle
- Register your handler in array
MainHandler/allHandler
- Star and Follow this project :-)