summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/smtpwrapper.h
blob: bdca000a5fb6abc704d40a0beee398a8e66eb8a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: C++; -*-
#ifndef SMTPwrapper_H
#define SMTPwrapper_H

//#include <qpe/applnk.h>

#include <qbitarray.h>
#include <qdatetime.h>
#include <libetpan/clist.h>

#include "settings.h"
#include "generatemail.h"

#include <opie2/osmartpointer.h>

class SMTPaccount;
class AbstractMail;

class SMTPwrapper : public Generatemail
{
    Q_OBJECT

public:
    SMTPwrapper(SMTPaccount * aSmtp);
    virtual ~SMTPwrapper();
    bool sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false );
    bool flushOutbox();

    static progressMailSend*sendProgress;
    virtual Account* getAccount() { return m_SmtpAccount; };

signals:
    void queuedMails( int );

protected:
    mailsmtp *m_smtp;
    SMTPaccount * m_SmtpAccount;

    void connect_server();
    void disc_server();
    int start_smtp_tls();


    bool smtpSend( mailmime *mail,bool later);

    static void storeMail(const char*mail, size_t length, const QString&box);
    static QString mailsmtpError( int err );
    static void progress( size_t current, size_t maximum );

    int smtpSend(char*from,clist*rcpts,const char*data,size_t size);

    void storeMail(mailmime*mail, const QString&box);

    int sendQueuedMail(AbstractMail*wrap,const Opie::Core::OSmartPointer<RecMail>&which);
    void storeFailedMail(const char*data,unsigned int size, const char*failuremessage);

    int m_queuedMail;

protected slots:
    void emitQCop( int queued );

};

#endif