Dependents:   TimeZoneDemo EthernetJackTestCode MMEx_Challenge ntp_mem ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EmailMessage.h Source File

EmailMessage.h

Go to the documentation of this file.
00001 
00002 /*
00003 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) y Segundo Equipo
00004 
00005 Permission is hereby granted, free of charge, to any person obtaining a copy
00006 of this software and associated documentation files (the "Software"), to deal
00007 in the Software without restriction, including without limitation the rights
00008 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00009 copies of the Software, and to permit persons to whom the Software is
00010 furnished to do so, subject to the following conditions:
00011 
00012 The above copyright notice and this permission notice shall be included in
00013 all copies or substantial portions of the Software.
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00018 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00020 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00021 THE SOFTWARE.
00022 */
00023 
00024 /** \file
00025 Email message header file
00026 */
00027 
00028 #ifndef EMAIL_MESSAGE_H
00029 #define EMAIL_MESSAGE_H
00030 
00031 #include <vector>
00032 using std::vector;
00033 
00034 #include <string>
00035 using std::string;
00036 
00037 ///A simple email message
00038 /**
00039 A class to hold the message addresses and content for sending (with SMTPClient).
00040 */
00041 class EmailMessage {
00042 public:
00043     ///Instantiates the email message
00044     EmailMessage();
00045 
00046     ///Destructor for the email message
00047     ~EmailMessage();
00048 
00049     ///Set FROM address
00050     /**
00051     @param from : email from address
00052     */
00053     void setFrom(const char* from);
00054 
00055     ///Add TO address to list of recipient addresses
00056     /**
00057     @param host : SMTP server host
00058     */
00059     void addTo(const char* to);
00060 
00061     ///Clear TO addresses
00062     void clearTo();
00063     
00064     ///Append text to content of message using printf
00065     /**
00066     @param format : printf format followed by ... variables
00067     
00068     Can be called multiple times to write the message
00069     */
00070     int printf(const char* format, ... );
00071 
00072     ///Clear content previously appended by printf
00073     void clearContent();
00074 
00075 private:
00076     friend class SMTPClient;
00077     string m_from;
00078     vector<string> m_lTo;
00079     string m_content;
00080 
00081 };
00082 
00083 #endif