Emailing Directly from an Arduino
To send an email from the Arduino, we’ll basically implement the telnet session from the previous chapter. Instead of hardwiring the email’s attributes into the networking code, we’ll create create something more advanced.
We start with an Email class:
Ethernet/Email/email.h | |
| #ifndef __EMAIL__H_ |
| #define __EMAIL__H_ |
| |
| class Email { |
| String _from, _to, _subject, _body; |
| |
| public: |
| |
| Email( |
| const String& from, |
| const String& to, |
| const String& subject, |
| const String& body |
| ) : _from(from), _to(to), _subject(subject), _body(body) {} |
| |
| const String& getFrom() const { return _from; } |
| const String& getTo() const { return _to; } |
| const String& getSubject() const { return |
Get Arduino: A Quick-Start Guide, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.