Go to the documentation of this file. 1 #ifndef UNTITLED_EMAIL_SENDER_H
2 #define UNTITLED_EMAIL_SENDER_H
20 #define arduinoIP "192.168.1.123" // ip address of Arduino
22 #define SMTPServerAddress "mail.smtp2go.com" // address of the smt2go server
23 #define SMTPServerPort 2525 // port of the service
25 #define emailAddress "" // Arduino's e-mail address
26 #define auth64Login "" // Arduino's e-mail login
27 #define auth64Pass "" // Arduino's e-mail password
64 byte mac[6] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
102 byte sendEmail(String subject, String data);
@ CHANGED_SETTINGS
when the user changes settings
const String getHTMLData(const int id) const
Since this class is registered as a source of data for the HTML content, it needs return the appropri...
static EmailSender * instance
the instance of EmailSender
friend String HTML_Notification_APPLIED_NEW_SETTING(const EmailSender &emailSender)
Associated function for returing the state of the 'applied settings' notification.
@ BYPASS
when a bypass changes
~EmailSender()
Descrutor of the class.
friend String HTML_Notification_BYPASS(const EmailSender &emailSender)
Associated function for returing the state of the 'bypass state' notification.
String getFormatOfSettingsToSave()
Returns settings.
String receiverEmailAddress
the default user's email address
std::map< Type, bool > enabled
map holding info about each time of e-mail - whether it's enabled or not
Type
different types of e-mail that can be sent to the user
void enableNotification(Type type, bool state)
Enables/disables the particular type of e-mail notification.
@ COUNT
total number of different kinds of e-mails
#define WEB_SERVER
enable the webserver
@ BOOTING
when the system boots up
friend String HTML_Notification_VALVE_STATE(const EmailSender &emailSender)
Associated function for returing the state of the 'valve state' notification.
void setReceiverEmailAddress(String email)
Changes the user's e-mail address.
friend String HTML_Notification_BOOTING(const EmailSender &emailSender)
Associated function for returing the state of the 'bootup' notification.
@ LEAK_DETECTED
when a leak has been detected
void efail()
Closes the ethernet client after the connection has failed.
EthernetClient client
EthernetClient used to connect to the smt2go server.
byte mac[6]
mac address of the ethernet shield
friend String HTML_ReceiverEmailAddress(const EmailSender &emailSender)
Associated function for returing the user's e-mail address.
EmailSender(EmailSender const &)
Copy constructor of the class.
byte sendEmail(String subject, String data)
Sends an e-mail off to the smtp2go server.
friend String HTML_Notification_CHANGED_SETTINGS(const EmailSender &emailSender)
Associated function for returing the state of the 'changed settings' notification.
@ VALVE_STATE
when the state of the valve has changed
@ RESET
when the device resets
@ APPLIED_NEW_SETTING
when the new settings are applied
byte eRcv()
Reads data using the ethernet client comming from the smtp2go server.
friend String HTML_Notification_ALARM(const EmailSender &emailSender)
Associated function for returing the state of the 'home alarm state' notification.
friend String HTML_Notification_DAILY_OVERVIEW(const EmailSender &emailSender)
Associated function for returing the state of the 'daily overview' notification.
EmailSender()
Constructor of the class.
@ DAILY_OVERVIEW
daily overview about the system
friend String HTML_Notification_LEAK_DETECTED(const EmailSender &emailSender)
Associated function for returing the state of the 'leak detected' notification.
int setEthernet()
Initializes the ethernet shield.
friend String HTML_Notification_RESET(const EmailSender &emailSender)
Associated function for returing the state of the 'system reset' notification.
@ ALARM
when the state of the home alarm changes
EmailSender & operator=(EmailSender const &)
Assignmet operator of the class.
std::map< int, String(*)(const EmailSender &leaksController)> htmlData
A map of different values (keys) and their associated functions which returns the appropriate values.
static EmailSender * getInstance()
Returns the instance of the class.