MailMessage.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * MailMessage.h
8  *
9  * @author Slavey Karadzhov <slaff@attachix.com>
10  *
11  ****/
12 
19 #pragma once
20 
21 #include "WString.h"
22 #include "WVector.h"
23 #include "Network/WebConstants.h"
25 #include "Stream/MultipartStream.h"
27 #include "Stream/FileStream.h"
28 
29 class SmtpClient;
30 
32 {
33  friend class SmtpClient;
34 
35 public:
40 
47  MailMessage& setHeader(const String& name, const String& value);
48 
54 
61  MailMessage& setBody(const String& body, MimeType mime = MIME_TEXT);
62 
70 
77 
85  MailMessage& addAttachment(IDataSourceStream* stream, MimeType mime, const String& filename = "");
86 
94  MailMessage& addAttachment(IDataSourceStream* stream, const String& mime, const String& filename = "");
95 
96 private:
97  IDataSourceStream* stream = nullptr;
98  HttpHeaders headers;
99  Vector<HttpPartResult> attachments;
100 };
101 
String to
Definition: MailMessage.h:36
HttpHeaders & getHeaders()
Get a reference to the current set of headers.
Base class for data source stream.
Definition: DataSourceStream.h:39
String subject
Definition: MailMessage.h:38
Definition: MailMessage.h:31
The String class.
Definition: WString.h:136
Encapsulates a set of HTTP header information.
Definition: HttpHeaders.h:96
File stream class.
Definition: FileStream.h:23
MailMessage & setHeader(const String &name, const String &value)
Set a header value.
String cc
Definition: MailMessage.h:39
MailMessage & setBody(const String &body, MimeType mime=MIME_TEXT)
Sets the body of the email.
MailMessage & addAttachment(FileStream *stream)
Adds attachment to the email.
Definition: SmtpClient.h:90
String from
Definition: MailMessage.h:37
IDataSourceStream * stream
The currently active stream being sent.
Definition: TcpClient.h:145
MimeType
Definition: WebConstants.h:54