📄 smtpclient.h
字号:
/******************************************************************************** Copyright (C) 2000-2006 TROLLTECH ASA. All rights reserved.**** This file is part of the Phone Edition of the Qtopia Toolkit.**** Licensees holding a valid license agreement from Trolltech or any of its** authorized distributors may use this file in accordance with** the License Agreement provided with the Licensed Software.**** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for** information about Trolltech's Commercial License Agreements.**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.********** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#ifndef SmtpClient_H#define SmtpClient_H#include <qtcpsocket.h>#include <qstring.h>#include <qobject.h>#include <qtextstream.h>#include <qstringlist.h>#include <qlist.h>#include "account.h"#include "client.h"#ifdef SMTPAUTH#include "qtsslsocket.h"#endifstruct RawEmail{ QString from; QString subject; QStringList to; QString body;};class SmtpClient: public Client{ Q_OBJECT public: SmtpClient(); ~SmtpClient(); void newConnection(); void addMail(QString from, QString subject, QStringList to, QString body); void setAccount(MailAccount *_account);signals: void errorOccurred(int, QString &); void updateStatus(const QString &); void transferredSize(int); void mailSent(int); public slots: void sent(qint64); void errorHandling(int, QString msg); void socketError(QAbstractSocket::SocketError);protected slots: void connectionEstablished(); void incomingData(); void authenticate();#ifdef SMTPAUTH void certCheckDone(QtSslSocket::VerifyResult result, bool hostNameMatched, const QString& description);#endifprivate: void createSocket(); void doSend();#ifdef SMTPAUTH QString _toBase64(const QString& in) const; void _switchSecure();#endifprivate: QTcpSocket *socket, *socketAuthenticate; QTextStream *stream, *streamLogin; MailAccount *account; #ifdef SMTPAUTH enum transferStatus { Init,Auth,AuthUser,AuthPass,StartTLS,TLS,Login,Pass,From,Recv,MRcv,Data,Body,Quit,Done }; QtSslSocket* _secureSocket; QTcpSocket* _plainSocket; #else enum transferStatus { Init, Login, Pass, From, Recv, MRcv, Data, Body, Quit, Done };#endif int status, sentSize; QList<RawEmail> mailList; QList<RawEmail>::Iterator mailItr; bool sending, authenticating, success; QStringList::Iterator it;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -