Commit 657e5fe8 authored by Andrei O.'s avatar Andrei O.
Browse files

alfa 0.1

parents
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>QtMassEmailSenderCvs</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
to,ton,from,fromn,var0,var1,var2,var3,var4,var5,var6
destination_email,destination_email_name,from_email,from_email_name,string for var 0 ,string for var 1,string for var 2,string for var 3,string for var 4,string for var 5,string for var 6
destination_email,destination_email_name,from_email,from_email_name,string for var 0 ,string for var 1,string for var 2,string for var 3,string for var 4,string for var 5,string for var 6
destination_email,destination_email_name,from_email,from_email_name,string for var 0 ,string for var 1,string for var 2,string for var 3,string for var 4,string for var 5,string for var 6
destination_email,destination_email_name,from_email,from_email_name,string for var 0 ,string for var 1,string for var 2,string for var 3,string for var 4,string for var 5,string for var 6
username,password,smtphost,ssl_tls_none,port
your_login_mail_account,your_password,smtp.gmail.com,ssl,465
second_login_mail_account,second_password,smtp.gmail.com,ssl,465
3_login_mail_account,3_password,smtp.gmail.com,ssl,465
n_login_mail_account,n_password,smtp.gmail.com,ssl,465
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#-------------------------------------------------
#
# Project created by QtCreator 2016-01-26T15:14:19
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = QtMassEmailSenderCvs
TEMPLATE = app
SOURCES += main.cpp\
qmesmainwindow.cpp \
qmessthredprocessmails.cpp \
qmescvsparsutil.cpp
HEADERS += qmesmainwindow.h \
qmessthredprocessmails.h \
qmescvsparsutil.h
Release:DESTDIR = bin/release
Release:OBJECTS_DIR = bin/release/.obj
Release:MOC_DIR = bin/release/.moc
Release:RCC_DIR = bin/release/.rcc
Release:UI_DIR = bin/release/.ui
Debug:DESTDIR = build/debug
Debug:OBJECTS_DIR = bin/debug/.obj
Debug:MOC_DIR = bin/debug/.moc
Debug:RCC_DIR = bin/debug/.rcc
Debug:UI_DIR = bin/debug/.ui
FORMS += qmesmainwindow.ui
# Location of SMTP Library
unix|win32: LIBS += -L$$PWD/smtpClientLib/lib/ -lSMTPEmail
INCLUDEPATH += $$PWD/smtpClientLib
DEPENDPATH += $$PWD/smtpClientLib
win32:!win32-g++: PRE_TARGETDEPS += $$PWD/smtpClientLib/lib/SMTPEmail.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$PWD/smtpClientLib/lib/libSMTPEmail.a
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 2.8.1, 2016-01-26T23:33:58. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">-1</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QString" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QByteArray">{7e2f14cb-5968-489f-9724-40ef6c8671c8}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">14</value>
</data>
</qtcreator>
#include "qmesmainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMESMainWindow w;
w.show();
return a.exec();
}
This diff is collapsed.
#ifndef QMESCVSPARSUTIL_H
#define QMESCVSPARSUTIL_H
#include <QLineEdit>
#include <QException>
#include "qmesmainwindow.h"
class QMESMainWindow;
class QmesCvsParsUtil
{
public:
QmesCvsParsUtil();
static void parseCsvAuth(QString fpath, QLineEdit *qe, QMESMainWindow *po);
static void parseCsvMail(QString filename, QLineEdit *qe, QMESMainWindow *po);
static QString parseVarInText(QString ptext, int mailLine, QMESMainWindow *po);
static bool csvAuthParsed;
static bool csvMailParsed;
static int cvsNbEmailToS;
static int cvsNbMAccLoad;
};
class QmesCsvInvalidHeadAuth : public QException
{
private:
public:
QmesCsvInvalidHeadAuth(){}
~QmesCsvInvalidHeadAuth(){}
};
class QmesCsvInvalidHeadMailSet : public QException
{
private:
public:
QmesCsvInvalidHeadMailSet(){}
~QmesCsvInvalidHeadMailSet(){}
};
class QmesCsvInvalidHeadMailVar : public QException
{
private:
public:
QmesCsvInvalidHeadMailVar(){}
~QmesCsvInvalidHeadMailVar(){}
};
class Qmescsvlinenotvalid : public QException
{
private:
public:
Qmescsvlinenotvalid(){}
~Qmescsvlinenotvalid(){}
};
#endif // QMESCVSPARSUTIL_H
#include <QFileDialog>
#include <QDir>
#include <QDebug>
#include <QFile>
#include <QSizeGrip>
#include <QThread>
#include <QtCore>
#include <QTime>
#include <QDate>
#include "qmessthredprocessmails.h"
#include "qmesmainwindow.h"
#include "ui_qmesmainwindow.h"
#include "qmescvsparsutil.h"
QMESMainWindow::QMESMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::QMESMainWindow)
{
ui->setupUi(this);
ui->sBoxNacc->setReadOnly(true);
ui->sBoxNmail->setReadOnly(true);
this->setFixedSize(1165,622);
}
QMESMainWindow::~QMESMainWindow()
{
delete ui;
}
void QMESMainWindow::printToLogTb(QString s){
ui->tBLogE->append(s.append(QString(" - ").append(QTime::currentTime().toString().append(" - ").append(QDate::currentDate().toString()))));
}
void QMESMainWindow::addtoLog(QString s){
this->logBuff.append(s.append(QString(" - ").append(QTime::currentTime().toString().append(" - ").append(QDate::currentDate().toString()))));
}
void QMESMainWindow::on_btLoadCsv_clicked()
{
QString fileName;
// Path for build
QString openDialogPathDebug = QDir::homePath().append("//QtMassEmailSenderCvs//CsvExamples");
QDir exDir = QDir();
QString openDialogPathRelease = exDir.absoluteFilePath("CsvExamples");
fileName = QFileDialog::getOpenFileName(this,
tr("Open CSV"), openDialogPathDebug, tr("CSV Files (*.csv)"));
QmesCvsParsUtil::parseCsvAuth(fileName, ui->edSmtpCred, this);
ui->sBoxNacc->setValue(QmesCvsParsUtil::cvsNbMAccLoad);
}
void QMESMainWindow::on_btLoadCsvMail_clicked()
{
QString fileName;
if(QMESDEBUG){
QString openDialogPathDebug = QDir::homePath().append("//QtMassEmailSenderCvs//CsvExamples");
fileName = QFileDialog::getOpenFileName(this,
tr("Open CSV"), openDialogPathDebug, tr("CSV Files (*.csv)"));
}else{
QDir exDir = QDir();
QString openDialogPathRelease = exDir.absoluteFilePath("CsvExamples");
fileName = QFileDialog::getOpenFileName(this,
tr("Open CSV"), openDialogPathRelease, tr("CSV Files (*.csv)"));
}
QmesCvsParsUtil::parseCsvMail(fileName, ui->edMailVar, this);
ui->sBoxNmail->setValue(QmesCvsParsUtil::cvsNbEmailToS);
QString debTxt = QmesCvsParsUtil::parseVarInText(ui->tBMsg->toHtml(),0,this);
ui->tBMsg->setHtml(debTxt);
}
void QMESMainWindow::on_btSMails_clicked()
{
if(QmesCvsParsUtil::csvAuthParsed && QmesCvsParsUtil::csvMailParsed ){
workerThread = new QmessThredProcessMails(this,ui->sBoxEtoSpAcc->value());
connect(workerThread, &QmessThredProcessMails::finished, workerThread, &QObject::deleteLater);
workerThread->start(QThread::NormalPriority);
}else{
QString logM = QString("<br/><span style='color:red'> ERROR:</span> The Cvs files have not been procesed.");
this->addtoLog(logM);
this->printToLogTb(logM);
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef QMESSTHREDPROCESSMAILS_H
#define QMESSTHREDPROCESSMAILS_H
#include <QThread>
#include "qmessthredprocessmails.h"
#include "qmesmainwindow.h"
class QMESMainWindow;
class QmessThredProcessMails : public QThread
{
Q_OBJECT
private:
bool jumpToNextAccIfErr;
int nrMailPerAcc;
QMESMainWindow *threadParent;
public:
explicit QmessThredProcessMails(QMESMainWindow *po, int nrMailPerAcc);
void setJnAcc(bool val);
void run() Q_DECL_OVERRIDE;
signals:
public slots:
};
#endif // QMESSTHREDPROCESSMAILS_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment