smtp-client
SMTP Client C Library
SMTPMail.h
Go to the documentation of this file.
1 
11 #ifndef SMTP_MAIL_H
12 #define SMTP_MAIL_H
13 
14 #include <exception>
15 
16 #include "smtp.h"
17 
23 class SMTPMailException : public std::exception{
24 public:
32 
39  virtual const char *const what() throw();
40 
41 private:
46 };
47 
53 class SMTPMail{
54 public:
58  SMTPMail(void);
59 
63  ~SMTPMail(void);
64 
77  void open(const char *const server,
78  const char *const port,
79  enum smtp_connection_security connection_security,
80  enum smtp_flag flags,
81  const char *const cafile);
82 
93  void auth(enum smtp_authentication_method auth_method,
94  const char *const user,
95  const char *const pass);
96 
105  void mail(const char *const body);
106 
113  void close(void);
114 
122  int status_code_get(void);
123 
131  void status_code_set(enum smtp_status_code new_status_code);
132 
144  void header_add(const char *const key,
145  const char *const value);
146 
152  void header_clear_all(void);
153 
167  void address_add(enum smtp_address_type type,
168  const char *const email,
169  const char *const name);
170 
176  void address_clear_all(void);
177 
186  void attachment_add_path(const char *const name,
187  const char *const path);
188 
197  void attachment_add_fp(const char *const name,
198  FILE *fp);
199 
213  void attachment_add_mem(const char *const name,
214  const void *const data,
215  ssize_t datasz);
216 
222  void attachment_clear_all(void);
223 
224 private:
228  struct smtp *smtp;
229 
234 
239  void throw_bad_status_code(void);
240 };
241 
242 #endif /* SMTP_MAIL_H */
243 
#define close
Definition: seams.h:81
smtp_connection_security
Definition: smtp.h:140
SMTPMailException(enum smtp_status_code status_code)
Definition: SMTPMail.cpp:13
struct smtp * smtp
Definition: SMTPMail.h:228
virtual const char *const what()
Definition: SMTPMail.cpp:18
smtp_status_code
Definition: smtp.h:32
smtp_authentication_method
Definition: smtp.h:170
enum smtp_status_code status_code
Definition: SMTPMail.h:45
Definition: smtp.c:150
SMTP client library.
smtp_flag
Definition: smtp.h:198
smtp_address_type
Definition: smtp.h:105