190 SMTP(
const char* from,
193 const char* smtpServer,
197 const char* username=0,
198 const char* password=0,
199 const char* clientDomainName=0,
200 const char* serverDomainName=0,
225 int write(
const char* txt,
int len = -1);
230 int printf(
const char* fmt, ...);
250 bool bit8() {
return eightBit?
true:
false; }
267 const char* clientDomainName;
268 const char* serverDomainName;
269 const char* contentType;
283 const char* smtpServer,
287 const char* username,
288 const char* password,
289 const char* clientDomainName,
290 const char* serverDomainName,
306#define SMTP_getEcode(o) (o)->eCode
310#define SMTP_setContentType(o,type) (o)->contentType=type
312#define SMTP_bit8(o) (o)->eightBit
319 const char* smtpServer,
323 const char* username,
324 const char* password,
325 const char* clientDomainName,
326 const char* serverDomainName,
328 SMTP_constructor(
this,from,to,subject,smtpServer,port,sharkSsl,startTLS?1:0,
329 username,password,clientDomainName,serverDomainName,ctx);
void setContentType(const char *type)
Set content-type.
Definition: SMTP.h:340
int SMTP_commit(SMTP *o)
Documentation: SMTP::commit.
#define SMTP_setContentType(o, type)
Documentation: SMTP::setContentType.
Definition: SMTP.h:310
const char * getEmsg()
Returns the SMTP error message if any.
Definition: SMTP.h:357
int SMTP_vprintf(SMTP *o, const char *fmt, va_list argList)
Documentation: SMTP::vprintf.
int write(const char *txt, int len=-1)
Add body text to email.
Definition: SMTP.h:344
int SMTP_printf(SMTP *o, const char *fmt,...)
Documentation: SMTP::printf.
~SMTP()
The destructor automatically commits the email if you do not call SMTP::commit.
Definition: SMTP.h:332
SMTP_ErrCode
SMTP error codes.
Definition: SMTP.h:63
SMTP(const char *from, const char *to, const char *subject, const char *smtpServer, int port=25, SharkSsl *sharkSsl=0, bool startTLS=false, const char *username=0, const char *password=0, const char *clientDomainName=0, const char *serverDomainName=0, SeCtx *ctx=0)
Initiate the SMTP email message.
Definition: SMTP.h:316
int addRecipient(const char *to)
Optionally add more recipients to this email.
Definition: SMTP.h:336
void SMTP_constructor(SMTP *o, const char *from, const char *to, const char *subject, const char *smtpServer, int port, SharkSsl *sharkSsl, int startTLS, const char *username, const char *password, const char *clientDomainName, const char *serverDomainName, SeCtx *ctx)
Documentation: SMTP::SMTP.
void SMTP_destructor(SMTP *o)
Documentation: SMTP::~SMTP.
int SMTP_write(SMTP *o, const char *txt, int len)
Documentation: SMTP::write.
int SMTP_addRecipient(SMTP *o, const char *to)
Documentation: SMTP::addRecipient.
int commit()
Commit (send) email.
Definition: SMTP.h:362
const char * SMTP_getEmsg(SMTP *o)
Returns the SMTP error message if any.
struct SMTP SMTP
This class is a minimal SMTP client that takes an email message body and passes it on to a SMTP serve...
int printf(const char *fmt,...)
Add body text to email.
Definition: SMTP.h:348
@ SMTP_ErrWriteStarted
Cannot add recipients after data is committed: see SMTP_DataCommitted.
Definition: SMTP.h:111
@ SMTP_ErrSocketClosed
Socket unexpectedly closed.
Definition: SMTP.h:103
@ SMTP_ErrNoAuthSup
Unknown/unsupported server authentication request.
Definition: SMTP.h:115
@ SMTP_ErrSmtpResponseCode
Cannot decode response data.
Definition: SMTP.h:107
@ SMTP_DataCommitted
Not an error code: means that the library has started sending data.
Definition: SMTP.h:69
@ SMTP_ErrHostName
Hostname does not resolve or the client is unable to connect to server.
Definition: SMTP.h:75
@ SMTP_ErrDATA
Failed sending the initial DATA message.
Definition: SMTP.h:95
@ SMTP_ErrRCPTTO
Failed sending RCPT TO:<s>
Definition: SMTP.h:99
@ SMTP_ErrCertNotTrusted
Server certificate not trusted.
Definition: SMTP.h:128
@ SMTP_ErrSslCon
SharkSsl_createCon failed.
Definition: SMTP.h:123
@ SMTP_ErrSocketCreate
Cannot create socket.
Definition: SMTP.h:79
@ SMTP_ErrMAILFROM
Failed sending MAIL FROM:<s> BODY=8BITMIME.
Definition: SMTP.h:91
@ SMTP_ErrConnect
Cannot connect.
Definition: SMTP.h:83
@ SMTP_ErrAuth
Server requires credentials, but no credentials were provided.
Definition: SMTP.h:119
@ SMTP_NoError
OK.
Definition: SMTP.h:66
@ SMTP_ErrHELO
EHLO (Extended SMTP (ESMTP)) required, but not supported by server.
Definition: SMTP.h:87
struct SharkSslCon SharkSslCon
SharkSslCon is an opaque handle returned by function SharkSsl_createCon.
Definition: SharkSSL.h:553
#define SOCKET
Infinite wait time option for socket read functions.
Definition: selib.h:102
This class is a minimal SMTP client that takes an email message body and passes it on to a SMTP serve...
Definition: SMTP.h:170
bool bit8()
Returns true if server supports 8BITMIME.
Definition: SMTP.h:250
SMTP_ErrCode getEcode() const
Get the error code (SMTP_ErrCode), if any.
Definition: SMTP.h:240
SeCtx structure: See Context Manager and Bare Metal Systems for details.
Definition: SeCtx.h:71
A SharkSsl object is the coordinator for managing SharkSslCon objects (See SharkSsl_constructor for d...
Definition: SharkSSL.h:561