BPS C++ API  2.24.4
bpssmtp.h
Go to the documentation of this file.
1 
4 #ifndef BPSSMTP_H
5 #define BPSSMTP_H
6 
7 #include "bpscore_global.h"
8 #include <QObject>
9 #include <QStringList>
10 
11 class BpsMail;
12 
88 {
89  Q_OBJECT
91 
92 public:
93 
97  enum Enc {
98  NoEnc = 0,
99  SSL = 1,
100  TLS = 2
101  };
102 
106  enum Auth {
107  NoAuth = 0,
108  Plain = 1,
109  Login = 2
110  };
111 
115  enum Status {
116  OK = 0,
117  Busy = 1,
118  ConnectionTimeout = 2,
119  ResponseTimeout = 3,
120  SendDataTimeout = 4,
121  AuthenticationFailed = 5,
122  StatusError = 6,
123  TempServerError = 7,
124  FatalServerError = 8,
125  DataError = 9
126  };
127 
132  BpsSmtp(QObject* aParent = nullptr);
133 
134  virtual ~BpsSmtp();
135 
139  QString host() const;
140 
145  void setHost(const QString& aHost);
146 
151  int port() const;
152 
157  void setPort(int aPort);
158 
164  int timeout() const;
165 
169  void setTimeout(int aTimeout);
170 
176  Enc enc() const;
177 
182  void setEnc(Enc aEnc);
183 
189  Auth auth() const;
190 
196  void setAuth(Auth aAuth);
197 
201  QString user() const;
202 
207  void setUser(const QString& aUser);
208 
212  QString password() const;
213 
218  void setPassword(const QString& aPassword);
219 
236  void sendMail(
237  const QString& aFrom,
238  const QString& aTo,
239  const QString& aSubject,
240  const QString& aText,
241  const QStringList& aFiles = QStringList());
242 
250  void sendMail(const BpsMail& aMail);
251 
256  bool busy() volatile;
257 
263 
267  int lastStatus() const;
268 
273 
274 signals:
275 
281  void status(int aStatus, const QString& aMessage);
282 };
283 
284 #endif // BPSSMTP_H
Public include file for BPS CORE library macros.
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
Mail object used for BpsSmtp.
Definition: bpsmail.h:15
A class for sending mail through a SMTP server.
Definition: bpssmtp.h:88
int port() const
Get host IP port number.
QString user() const
void setPassword(const QString &aPassword)
Set the SMTP user password.
bool busy() volatile
Check processing state.
void setAuth(Auth aAuth)
Set the authentication mode.
Auth auth() const
Get authentication mode.
void setEnc(Enc aEnc)
Set the encryption mode.
Enc
Connection type used.
Definition: bpssmtp.h:97
void setUser(const QString &aUser)
Set the SMTP user name.
QString lastStatusMessage() const
int timeout() const
Get time out value.
Status
Status code.
Definition: bpssmtp.h:115
void setHost(const QString &aHost)
Set SMTP server host name or IP address.
void setPort(int aPort)
Set the SMTP servers IP port number.
QString host() const
QString password() const
Enc enc() const
Get encryption mode.
void sendMail(const BpsMail &aMail)
Send a mail.
int lastStatus() const
Auth
Authentication used.
Definition: bpssmtp.h:106
void sendMail(const QString &aFrom, const QString &aTo, const QString &aSubject, const QString &aText, const QStringList &aFiles=QStringList())
Send a simple mail.
void setTimeout(int aTimeout)
void status(int aStatus, const QString &aMessage)
Status code and message emitted after completion.
void waitForCompletion()
Wait for sendMail completion.
BpsSmtp(QObject *aParent=nullptr)
Constructor for the BpsSmtp objects.