2010-08-19 22:47:57 +04:00
|
|
|
/****************************************************************************
|
|
|
|
** $Id: qt/smtp.h 3.3.6 edited Aug 31 2005 $
|
|
|
|
**
|
|
|
|
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
|
|
|
|
**
|
|
|
|
** This file is part of an example program for Qt. This example
|
|
|
|
** program may be used, distributed and modified without limitation.
|
|
|
|
**
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef SMTP_H
|
|
|
|
#define SMTP_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QObject>
|
2011-01-15 19:53:37 +03:00
|
|
|
#include <QByteArray>
|
2010-08-19 22:47:57 +04:00
|
|
|
|
2011-02-27 18:41:05 +03:00
|
|
|
QT_BEGIN_NAMESPACE
|
2010-08-19 22:47:57 +04:00
|
|
|
struct QTextStream;
|
|
|
|
struct QTcpSocket;
|
2011-01-15 19:53:37 +03:00
|
|
|
class QTextCodec;
|
2011-02-27 18:41:05 +03:00
|
|
|
QT_END_NAMESPACE
|
2010-08-19 22:47:57 +04:00
|
|
|
|
|
|
|
class Smtp : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Smtp(const QString &from, const QString &to, const QString &subject, const QString &body);
|
|
|
|
~Smtp();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void readyRead();
|
|
|
|
|
|
|
|
private:
|
2011-01-15 19:53:37 +03:00
|
|
|
QByteArray encode_mime_header(const QString& key, const QString& value, QTextCodec* latin1, const QByteArray& prefix=QByteArray());
|
|
|
|
|
|
|
|
private:
|
|
|
|
QByteArray message;
|
2010-08-19 22:47:57 +04:00
|
|
|
QTextStream *t;
|
|
|
|
QTcpSocket *socket;
|
|
|
|
QString from;
|
|
|
|
QString rcpt;
|
|
|
|
QString response;
|
2011-01-15 19:53:37 +03:00
|
|
|
enum states{Rcpt,Mail,Mail2,Data,Init,Body,Quit,Close};
|
2010-08-19 22:47:57 +04:00
|
|
|
int state;
|
|
|
|
|
|
|
|
};
|
|
|
|
#endif
|