upload project
This commit is contained in:
commit
18786d2015
33
SMTPEmail.pro
Normal file
33
SMTPEmail.pro
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2011-08-11T20:59:25
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
QT += core gui network
|
||||||
|
|
||||||
|
TARGET = SMTPEmail
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
|
||||||
|
SOURCES += main.cpp \
|
||||||
|
smtpclient.cpp \
|
||||||
|
mimemessage.cpp \
|
||||||
|
mimepart.cpp \
|
||||||
|
mimetext.cpp \
|
||||||
|
mimeattachment.cpp \
|
||||||
|
mimehtml.cpp \
|
||||||
|
emailaddress.cpp \
|
||||||
|
mimefile.cpp \
|
||||||
|
mimeinlinefile.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
smtpclient.h \
|
||||||
|
mimemessage.h \
|
||||||
|
mimepart.h \
|
||||||
|
mimetext.h \
|
||||||
|
mimeattachment.h \
|
||||||
|
mimehtml.h \
|
||||||
|
emailaddress.h \
|
||||||
|
mimefile.h \
|
||||||
|
mimeinlinefile.h
|
307
SMTPEmail.pro.user
Normal file
307
SMTPEmail.pro.user
Normal file
@ -0,0 +1,307 @@
|
|||||||
|
<!DOCTYPE QtCreatorProject>
|
||||||
|
<qtcreator>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
<value type="int">0</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<value key="EditorConfiguration.AutoIndent" type="bool">true</value>
|
||||||
|
<value key="EditorConfiguration.AutoSpacesForTabs" type="bool">false</value>
|
||||||
|
<value key="EditorConfiguration.Codec" type="QByteArray">System</value>
|
||||||
|
<value key="EditorConfiguration.DoubleIndentBlocks" type="bool">false</value>
|
||||||
|
<value key="EditorConfiguration.IndentBraces" type="bool">false</value>
|
||||||
|
<value key="EditorConfiguration.IndentSize" type="int">4</value>
|
||||||
|
<value key="EditorConfiguration.MouseNavigation" type="bool">true</value>
|
||||||
|
<value key="EditorConfiguration.PaddingMode" type="int">1</value>
|
||||||
|
<value key="EditorConfiguration.ScrollWheelZooming" type="bool">true</value>
|
||||||
|
<value key="EditorConfiguration.SmartBackspace" type="bool">false</value>
|
||||||
|
<value key="EditorConfiguration.SpacesForTabs" type="bool">true</value>
|
||||||
|
<value key="EditorConfiguration.TabKeyBehavior" type="int">0</value>
|
||||||
|
<value key="EditorConfiguration.TabSize" type="int">8</value>
|
||||||
|
<value key="EditorConfiguration.UseGlobal" type="bool">true</value>
|
||||||
|
<value key="EditorConfiguration.Utf8BomBehavior" type="int">1</value>
|
||||||
|
<value key="EditorConfiguration.addFinalNewLine" type="bool">true</value>
|
||||||
|
<value key="EditorConfiguration.cleanIndentation" type="bool">true</value>
|
||||||
|
<value key="EditorConfiguration.cleanWhitespace" type="bool">true</value>
|
||||||
|
<value key="EditorConfiguration.inEntireDocument" type="bool">false</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Desktop</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
|
||||||
|
<value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
|
||||||
|
<value key="ProjectExplorer.Target.ActiveDeployConfiguration" type="int">0</value>
|
||||||
|
<value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
|
||||||
|
<valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.BuildCOnfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
|
||||||
|
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString">clean</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
|
||||||
|
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Desktop Qt 4.7.3 for GCC (Qt SDK) Release</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/bluetiger/Dev/Qt/SMTPEmail-build-desktop</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">3</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.BuildCOnfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
|
||||||
|
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString">clean</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
|
||||||
|
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Desktop Qt 4.7.3 for GCC (Qt SDK) Debug</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/bluetiger/Dev/Qt/SMTPEmail-build-desktop</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">3</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap key="ProjectExplorer.Target.BuildConfiguration.2" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.BuildCOnfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
|
||||||
|
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString">clean</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
|
||||||
|
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Qt in PATH Release</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/bluetiger/Dev/Qt/SMTPEmail-build-desktop</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">4</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap key="ProjectExplorer.Target.BuildConfiguration.3" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.BuildCOnfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
|
||||||
|
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
|
||||||
|
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
|
||||||
|
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString">clean</value>
|
||||||
|
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
|
||||||
|
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Qt in PATH Debug</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/bluetiger/Dev/Qt/SMTPEmail-build-desktop</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">4</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">4</value>
|
||||||
|
<valuemap key="ProjectExplorer.Target.DeployConfiguration.0" type="QVariantMap">
|
||||||
|
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
|
||||||
|
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">0</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Deploy</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Deploy</value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">1</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">No deployment</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.Target.DeployConfigurationCount" type="int">1</value>
|
||||||
|
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
|
||||||
|
<valuelist key="Analyzer.Valgrind.AddedSupressionFiles" type="QVariantList"/>
|
||||||
|
<value key="Analyzer.Valgrind.FilterExternalIssues" type="bool">true</value>
|
||||||
|
<value key="Analyzer.Valgrind.NumCallers" type="int">25</value>
|
||||||
|
<valuelist key="Analyzer.Valgrind.RemovedSupressionFiles" type="QVariantList"/>
|
||||||
|
<value key="Analyzer.Valgrind.TrackOrigins" type="bool">true</value>
|
||||||
|
<value key="Analyzer.Valgrind.ValgrindExecutable" type="QString">valgrind</value>
|
||||||
|
<valuelist key="Analyzer.Valgrind.VisibleErrorKinds" type="QVariantList">
|
||||||
|
<value type="int">0</value>
|
||||||
|
<value type="int">1</value>
|
||||||
|
<value type="int">2</value>
|
||||||
|
<value type="int">3</value>
|
||||||
|
<value type="int">4</value>
|
||||||
|
<value type="int">5</value>
|
||||||
|
<value type="int">6</value>
|
||||||
|
<value type="int">7</value>
|
||||||
|
<value type="int">8</value>
|
||||||
|
<value type="int">9</value>
|
||||||
|
<value type="int">10</value>
|
||||||
|
<value type="int">11</value>
|
||||||
|
<value type="int">12</value>
|
||||||
|
<value type="int">13</value>
|
||||||
|
<value type="int">14</value>
|
||||||
|
</valuelist>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">SMTPEmail</value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
||||||
|
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QString"></value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">SMTPEmail.pro</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
|
||||||
|
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
|
||||||
|
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
|
||||||
|
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
|
||||||
|
<value key="RunConfiguration.QmlDebugServerPort" type="uint">3768</value>
|
||||||
|
<value key="RunConfiguration.UseCppDebugger" type="bool">true</value>
|
||||||
|
<value key="RunConfiguration.UseQmlDebugger" type="bool">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
|
||||||
|
<value type="QString">{b0e80f08-a784-4568-bc8d-4b27a017e1d9}</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||||
|
<value type="int">9</value>
|
||||||
|
</data>
|
||||||
|
</qtcreator>
|
42
emailaddress.cpp
Normal file
42
emailaddress.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include "emailaddress.h"
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
EmailAddress::EmailAddress(const QString & address, const QString & name)
|
||||||
|
{
|
||||||
|
this->address = address;
|
||||||
|
this->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
EmailAddress::~EmailAddress()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
void EmailAddress::setName(const QString & name)
|
||||||
|
{
|
||||||
|
this->name = name;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void EmailAddress::setAddress(const QString & address)
|
||||||
|
{
|
||||||
|
this->address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & EmailAddress::getName() const
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & EmailAddress::getAddress() const
|
||||||
|
{
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
41
emailaddress.h
Normal file
41
emailaddress.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#ifndef EMAILADDRESS_H
|
||||||
|
#define EMAILADDRESS_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class EmailAddress : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
EmailAddress();
|
||||||
|
EmailAddress(const QString & address, const QString & name="");
|
||||||
|
|
||||||
|
~EmailAddress();
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
void setName(const QString & name);
|
||||||
|
void setAddress(const QString & address);
|
||||||
|
|
||||||
|
const QString & getName() const;
|
||||||
|
const QString & getAddress() const;
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/* [3] Private members */
|
||||||
|
|
||||||
|
QString name;
|
||||||
|
QString address;
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EMAILADDRESS_H
|
101
mail.cpp
Normal file
101
mail.cpp
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
#include "mail.h"
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
Mail::Mail()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mail::setSender(QString address, QString name)
|
||||||
|
{
|
||||||
|
this->sender = new EmailAddress(address, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mail::addRecipient(QString rcpt, QString name)
|
||||||
|
{
|
||||||
|
this->recipients << EmailAddress (rcpt, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mail::setSubject(QString subject)
|
||||||
|
{
|
||||||
|
this->subject = subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mail::setContent(QString text)
|
||||||
|
{
|
||||||
|
this->text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
EmailAddress & Mail::getSender()
|
||||||
|
{
|
||||||
|
return *sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<EmailAddress> & Mail::getRecipients()
|
||||||
|
{
|
||||||
|
return recipients;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString & Mail::getSubject()
|
||||||
|
{
|
||||||
|
return subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString & Mail::getText()
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mail::addAttachment(QFile *file, QString type)
|
||||||
|
{
|
||||||
|
attachments << Attachment (*file, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<Attachment> & Mail::getAttachments()
|
||||||
|
{
|
||||||
|
return attachments;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/****** Email Address *******/
|
||||||
|
EmailAddress::EmailAddress(QString address, QString name)
|
||||||
|
{
|
||||||
|
this->address = address;
|
||||||
|
this->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString EmailAddress::getAddress() const
|
||||||
|
{
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString EmailAddress::getName() const
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/****** Attachment *******/
|
||||||
|
Attachment::Attachment(QFile& file, QString type) :
|
||||||
|
file(file)
|
||||||
|
{
|
||||||
|
//this->file = file;
|
||||||
|
this->type = type;
|
||||||
|
this->name = QFileInfo(file).fileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile& Attachment::getFile() const
|
||||||
|
{
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Attachment::getName() const
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Attachment::getType() const
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
81
mail.h
Normal file
81
mail.h
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
#ifndef MAIL_H
|
||||||
|
#define MAIL_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
class EmailAddress;
|
||||||
|
class Attachment;
|
||||||
|
|
||||||
|
class Mail : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
Mail();
|
||||||
|
|
||||||
|
enum ContentType
|
||||||
|
{
|
||||||
|
Html,
|
||||||
|
PlainText
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void setSender(QString sender, QString name="");
|
||||||
|
void setSender(EmailAddress adr);
|
||||||
|
|
||||||
|
void addRecipient(QString rcpt, QString name="");
|
||||||
|
void setSubject(QString title);
|
||||||
|
void setContent(QString text);
|
||||||
|
void setEncoding(QString text);
|
||||||
|
void addAttachment(QFile* file, QString type="application/octet-stream");
|
||||||
|
|
||||||
|
EmailAddress& getSender();
|
||||||
|
QList<EmailAddress>& getRecipients();
|
||||||
|
QString& getSubject();
|
||||||
|
QString& getText();
|
||||||
|
QList<Attachment>& getAttachments();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
EmailAddress* sender;
|
||||||
|
QList<EmailAddress> recipients;
|
||||||
|
QString subject;
|
||||||
|
QString text;
|
||||||
|
QList<Attachment> attachments;
|
||||||
|
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
class EmailAddress
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EmailAddress(QString address, QString name="");
|
||||||
|
|
||||||
|
QString getName() const;
|
||||||
|
QString getAddress() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString name;
|
||||||
|
QString address;
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Attachment
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Attachment(QFile& file, QString type = "application/octet-stream");
|
||||||
|
|
||||||
|
QString getName() const;
|
||||||
|
QFile& getFile() const;
|
||||||
|
QString getType() const;
|
||||||
|
|
||||||
|
void setName(QString name);
|
||||||
|
void setType(QString type);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QFile& file;
|
||||||
|
QString name;
|
||||||
|
QString type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // MAIL_H
|
27
mimeattachment.cpp
Normal file
27
mimeattachment.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "mimeattachment.h"
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeAttachment::MimeAttachment(QFile *file)
|
||||||
|
: MimeFile(file)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
MimeAttachment::~MimeAttachment()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Protected methods */
|
||||||
|
|
||||||
|
void MimeAttachment::prepare()
|
||||||
|
{
|
||||||
|
MimeFile::prepare();
|
||||||
|
|
||||||
|
this->header += "Content-disposition: attachment;\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [2] --- */
|
29
mimeattachment.h
Normal file
29
mimeattachment.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef MIMEATTACHMENT_H
|
||||||
|
#define MIMEATTACHMENT_H
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include "mimepart.h"
|
||||||
|
#include "mimefile.h"
|
||||||
|
|
||||||
|
class MimeAttachment : public MimeFile
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeAttachment(QFile* file);
|
||||||
|
~MimeAttachment();
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/* [2] Protected methods */
|
||||||
|
|
||||||
|
void prepare();
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MIMEATTACHMENT_H
|
59
mimefile.cpp
Normal file
59
mimefile.cpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
#include "mimefile.h"
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeFile::MimeFile(QFile *file)
|
||||||
|
{
|
||||||
|
this->file = file;
|
||||||
|
this->type = "application/octet-stream";
|
||||||
|
this->name = QFileInfo(*file).fileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
MimeFile::~MimeFile()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and setters */
|
||||||
|
|
||||||
|
void MimeFile::setName(const QString & name)
|
||||||
|
{
|
||||||
|
this->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MimeFile::setType(const QString & type)
|
||||||
|
{
|
||||||
|
this->type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & MimeFile::getName() const
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & MimeFile::getType() const
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [3] Protected methods */
|
||||||
|
|
||||||
|
void MimeFile::prepare()
|
||||||
|
{
|
||||||
|
this->header = "Content-Type: " + type + "; name=" + name + "\n";
|
||||||
|
this->header += "Content-Transfer-Encoding: base64\n";
|
||||||
|
|
||||||
|
file->open(QIODevice::ReadOnly);
|
||||||
|
this->content = file->readAll().toBase64() + "\n";
|
||||||
|
file->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
|
49
mimefile.h
Normal file
49
mimefile.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#ifndef MIMEFILE_H
|
||||||
|
#define MIMEFILE_H
|
||||||
|
|
||||||
|
#include "mimepart.h"
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
class MimeFile : public MimePart
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeFile(QFile *f);
|
||||||
|
~MimeFile();
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
void setName(const QString & name);
|
||||||
|
void setType(const QString & type);
|
||||||
|
|
||||||
|
const QString & getName() const;
|
||||||
|
const QString & getType() const;
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/* [3] Protected members */
|
||||||
|
|
||||||
|
QFile* file;
|
||||||
|
QString name;
|
||||||
|
QString type;
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [4] Protected methods */
|
||||||
|
|
||||||
|
void prepare();
|
||||||
|
|
||||||
|
/* [4] --- */
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MIMEFILE_H
|
66
mimehtml.cpp
Normal file
66
mimehtml.cpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#include "mimehtml.h"
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeHtml::MimeHtml()
|
||||||
|
{
|
||||||
|
this->html = "";
|
||||||
|
this->encoding = PlainText;
|
||||||
|
this->charset = "utf-8";
|
||||||
|
}
|
||||||
|
|
||||||
|
MimeHtml::~MimeHtml() {}
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
void MimeHtml::setHtml(const QString & html)
|
||||||
|
{
|
||||||
|
this->html = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MimeHtml::setEncoding(MimePart::Encoding enc)
|
||||||
|
{
|
||||||
|
this->encoding = enc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MimeHtml::setCharset(const QString & charset)
|
||||||
|
{
|
||||||
|
this->charset = charset;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & MimeHtml::getHtml() const
|
||||||
|
{
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & MimeHtml::getCharset() const
|
||||||
|
{
|
||||||
|
return charset;
|
||||||
|
}
|
||||||
|
|
||||||
|
MimePart::Encoding MimeHtml::getEncoding() const
|
||||||
|
{
|
||||||
|
return encoding;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [3] Protected methods */
|
||||||
|
|
||||||
|
void MimeHtml::prepare()
|
||||||
|
{
|
||||||
|
this->header = "Content-Type: text/html; charset="
|
||||||
|
+ this->charset + "\n";
|
||||||
|
|
||||||
|
this->header += "Content-Transfer-Encoding: ";
|
||||||
|
this->header += (this->encoding == PlainText) ? "7bit\n" : "base64\n";
|
||||||
|
|
||||||
|
this->content = (this->encoding == PlainText) ? this->html.toAscii() : QByteArray().append(this->html).toBase64();
|
||||||
|
this->content += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [3] --- */
|
49
mimehtml.h
Normal file
49
mimehtml.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#ifndef MIMEHTML_H
|
||||||
|
#define MIMEHTML_H
|
||||||
|
|
||||||
|
#include "mimepart.h"
|
||||||
|
|
||||||
|
class MimeHtml : public MimePart
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeHtml();
|
||||||
|
~MimeHtml();
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
void setHtml(const QString & html);
|
||||||
|
void setEncoding(Encoding enc);
|
||||||
|
void setCharset(const QString & charset);
|
||||||
|
|
||||||
|
const QString& getHtml() const;
|
||||||
|
const QString& getCharset() const;
|
||||||
|
Encoding getEncoding() const;
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/* [3] Protected members */
|
||||||
|
|
||||||
|
QString html;
|
||||||
|
QString charset;
|
||||||
|
Encoding encoding;
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [4] Protected methods */
|
||||||
|
|
||||||
|
void prepare();
|
||||||
|
|
||||||
|
/* [4] --- */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MIMEHTML_H
|
45
mimeinlinefile.cpp
Normal file
45
mimeinlinefile.cpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#include "mimeinlinefile.h"
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeInlineFile::MimeInlineFile(QFile *f)
|
||||||
|
: MimeFile(f)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MimeInlineFile::~MimeInlineFile()
|
||||||
|
{}
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
void MimeInlineFile::setContentId(const QString & cid)
|
||||||
|
{
|
||||||
|
this->cid = cid;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & MimeInlineFile::getContentId() const
|
||||||
|
{
|
||||||
|
return cid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [3] Protected methods */
|
||||||
|
|
||||||
|
void MimeInlineFile::prepare()
|
||||||
|
{
|
||||||
|
MimeFile::prepare();
|
||||||
|
|
||||||
|
this->header += "Content-id: <" + cid + ">\n";
|
||||||
|
this->header += "Content-disposition: inline\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
|
||||||
|
|
||||||
|
|
41
mimeinlinefile.h
Normal file
41
mimeinlinefile.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#ifndef MIMEINLINEFILE_H
|
||||||
|
#define MIMEINLINEFILE_H
|
||||||
|
|
||||||
|
#include "mimefile.h"
|
||||||
|
|
||||||
|
class MimeInlineFile : public MimeFile
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeInlineFile(QFile *f);
|
||||||
|
~MimeInlineFile();
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
void setContentId(const QString & cid);
|
||||||
|
const QString & getContentId() const;
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/* [3] Protected members */
|
||||||
|
|
||||||
|
QString cid;
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [4] Protected methods */
|
||||||
|
|
||||||
|
void prepare();
|
||||||
|
|
||||||
|
/* [4] --- */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MIMEINLINEFILE_H
|
93
mimemessage.cpp
Normal file
93
mimemessage.cpp
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
#include "mimemessage.h"
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeMessage::MimeMessage()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
MimeMessage::~MimeMessage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
void MimeMessage::setSender(EmailAddress* e)
|
||||||
|
{
|
||||||
|
this->sender = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MimeMessage::addRecipient(EmailAddress* rcpt)
|
||||||
|
{
|
||||||
|
this->recipients << rcpt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MimeMessage::setSubject(const QString & subject)
|
||||||
|
{
|
||||||
|
this->subject = subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MimeMessage::addPart(MimePart *part)
|
||||||
|
{
|
||||||
|
this->parts << part;
|
||||||
|
}
|
||||||
|
|
||||||
|
const EmailAddress & MimeMessage::getSender() const
|
||||||
|
{
|
||||||
|
return *sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<EmailAddress*> & MimeMessage::getRecipients() const
|
||||||
|
{
|
||||||
|
return recipients;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & MimeMessage::getSubject() const
|
||||||
|
{
|
||||||
|
return subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<MimePart*> & MimeMessage::getParts() const
|
||||||
|
{
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [3] Public Methods */
|
||||||
|
|
||||||
|
QString MimeMessage::toString()
|
||||||
|
{
|
||||||
|
QString mime;
|
||||||
|
mime = "From: " + sender->getName() + " <" + sender->getAddress() + ">\n";
|
||||||
|
|
||||||
|
QList<EmailAddress*>::iterator it;
|
||||||
|
for (it = recipients.begin(); it != recipients.end(); ++it)
|
||||||
|
mime += "To: " + (*it)->getName() + " <" + (*it)->getAddress() + ">\n";
|
||||||
|
|
||||||
|
mime += "Subject: " + subject + "\n";
|
||||||
|
|
||||||
|
QString boundary = "----MIME-part-boundary=" + QByteArray().append(QDateTime::currentDateTime().toString()).toBase64() + "-end";
|
||||||
|
|
||||||
|
mime += "MIME-Version: 1.0\n";
|
||||||
|
mime += "Content-type: multipart/mixed; boundary=\"" + boundary + "\"\n\n";
|
||||||
|
|
||||||
|
boundary = "--" + boundary;
|
||||||
|
|
||||||
|
QList<MimePart*>::iterator i;
|
||||||
|
for (i = parts.begin(); i != parts.end(); ++i)
|
||||||
|
mime += boundary + "\n" + (*i)->toString();
|
||||||
|
|
||||||
|
mime += boundary + "--\n";
|
||||||
|
|
||||||
|
return mime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [3] --- */
|
55
mimemessage.h
Normal file
55
mimemessage.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#ifndef MIMEMESSAGE_H
|
||||||
|
#define MIMEMESSAGE_H
|
||||||
|
|
||||||
|
#include <mimepart.h>
|
||||||
|
#include <emailaddress.h>
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
|
class MimeMessage : public QObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeMessage();
|
||||||
|
~MimeMessage();
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
void setSender(EmailAddress* e);
|
||||||
|
void addRecipient(EmailAddress* rcpt);
|
||||||
|
void setSubject(const QString & subject);
|
||||||
|
void addPart(MimePart* part);
|
||||||
|
|
||||||
|
const EmailAddress & getSender() const;
|
||||||
|
const QList<EmailAddress*> & getRecipients() const;
|
||||||
|
const QString & getSubject() const;
|
||||||
|
const QList<MimePart*> & getParts() const;
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [3] Public methods */
|
||||||
|
|
||||||
|
QString toString();
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/* [4] Protected members */
|
||||||
|
|
||||||
|
EmailAddress* sender;
|
||||||
|
QList<EmailAddress*> recipients;
|
||||||
|
QString subject;
|
||||||
|
QList<MimePart*> parts;
|
||||||
|
|
||||||
|
/* [4] --- */
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MIMEMESSAGE_H
|
62
mimepart.cpp
Normal file
62
mimepart.cpp
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#include "mimepart.h"
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimePart::MimePart()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
MimePart::~MimePart()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
void MimePart::setContent(const QString & content)
|
||||||
|
{
|
||||||
|
this->content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MimePart::setHeader(const QString & header)
|
||||||
|
{
|
||||||
|
this->header = header;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MimePart::addHeaderLine(const QString & line)
|
||||||
|
{
|
||||||
|
this->header += line;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString& MimePart::getHeader() const
|
||||||
|
{
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString& MimePart::getContent() const
|
||||||
|
{
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [3] Public methods */
|
||||||
|
|
||||||
|
QString MimePart::toString()
|
||||||
|
{
|
||||||
|
prepare();
|
||||||
|
return header + "\n" + content;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [4] Protected methods */
|
||||||
|
|
||||||
|
void MimePart::prepare() {}
|
||||||
|
|
||||||
|
/* [4] --- */
|
68
mimepart.h
Normal file
68
mimepart.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#ifndef MIMEPART_H
|
||||||
|
#define MIMEPART_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class MimePart : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* [0] Enumerations */
|
||||||
|
|
||||||
|
enum Encoding {
|
||||||
|
PlainText,
|
||||||
|
Base64,
|
||||||
|
_7Bit,
|
||||||
|
_8Bit,
|
||||||
|
QuotedPrintable // not implemented
|
||||||
|
};
|
||||||
|
|
||||||
|
/* [0] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimePart();
|
||||||
|
~MimePart();
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
const QString& getHeader() const;
|
||||||
|
const QString& getContent() const;
|
||||||
|
|
||||||
|
void setContent(const QString & content);
|
||||||
|
void setHeader(const QString & header);
|
||||||
|
|
||||||
|
void addHeaderLine(const QString & line);
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [3] Public methods */
|
||||||
|
|
||||||
|
QString toString();
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/* [4] Protected members */
|
||||||
|
|
||||||
|
QString header;
|
||||||
|
QString content;
|
||||||
|
|
||||||
|
/* [4] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [5] Protected methods */
|
||||||
|
|
||||||
|
virtual void prepare();
|
||||||
|
|
||||||
|
/* [5] --- */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MIMEPART_H
|
66
mimetext.cpp
Normal file
66
mimetext.cpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#include "mimetext.h"
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeText::MimeText()
|
||||||
|
{
|
||||||
|
this->charset = "utf-8";
|
||||||
|
this->encoding = PlainText;
|
||||||
|
}
|
||||||
|
|
||||||
|
MimeText::~MimeText() { }
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
void MimeText::setText(const QString & text)
|
||||||
|
{
|
||||||
|
this->text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MimeText::setEncoding(MimePart::Encoding enc)
|
||||||
|
{
|
||||||
|
this->encoding = enc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MimeText::setCharset(const QString & charset)
|
||||||
|
{
|
||||||
|
this->charset = charset;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & MimeText::getText() const
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
MimePart::Encoding MimeText::getEncoding() const
|
||||||
|
{
|
||||||
|
return encoding;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & MimeText::getCharset() const
|
||||||
|
{
|
||||||
|
return charset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [3] Protected Methods */
|
||||||
|
|
||||||
|
void MimeText::prepare()
|
||||||
|
{
|
||||||
|
this->header = "Content-Type: text/plain; charset: "
|
||||||
|
+ this->charset + "\n";
|
||||||
|
|
||||||
|
this->header += "Content-Transfer-Encoding: ";
|
||||||
|
this->header += (this->encoding == PlainText) ? "7bit\n" : "base64\n";
|
||||||
|
|
||||||
|
this->content = (this->encoding == PlainText) ? this->text.toAscii() : QByteArray().append(this->text).toBase64();
|
||||||
|
this->content += "\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [3] --- */
|
49
mimetext.h
Normal file
49
mimetext.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#ifndef MIMETEXT_H
|
||||||
|
#define MIMETEXT_H
|
||||||
|
|
||||||
|
#include "mimepart.h"
|
||||||
|
|
||||||
|
class MimeText : public MimePart
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
MimeText();
|
||||||
|
~MimeText();
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters*/
|
||||||
|
|
||||||
|
void setText(const QString & text);
|
||||||
|
void setEncoding(Encoding enc);
|
||||||
|
void setCharset(const QString & charset);
|
||||||
|
|
||||||
|
const QString & getText() const;
|
||||||
|
MimePart::Encoding getEncoding() const;
|
||||||
|
const QString & getCharset() const;
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/* [3] Protected members */
|
||||||
|
|
||||||
|
QString text;
|
||||||
|
QString charset;
|
||||||
|
Encoding encoding;
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [4] Protected methods */
|
||||||
|
|
||||||
|
void prepare();
|
||||||
|
|
||||||
|
/* [4] --- */
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MIMETEXT_H
|
337
smtpclient.cpp
Normal file
337
smtpclient.cpp
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) Tőkés Attila (bluetiger9)
|
||||||
|
|
||||||
|
Released under LGPL 2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "smtpclient.h"
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
|
||||||
|
/* [1] Constructors and destructors */
|
||||||
|
|
||||||
|
SmtpClient::SmtpClient(QString host, int port, ConnectionType ct) :
|
||||||
|
authMethod(AuthPlain),
|
||||||
|
connectionTimeout(5000),
|
||||||
|
responseTimeout(5000)
|
||||||
|
{
|
||||||
|
if (ct == TcpConnection)
|
||||||
|
this->useSsl = false;
|
||||||
|
else if (ct == SslConnection)
|
||||||
|
this->useSsl = true;
|
||||||
|
|
||||||
|
if (useSsl == false)
|
||||||
|
socket = new QTcpSocket(this);
|
||||||
|
else
|
||||||
|
socket = new QSslSocket(this);
|
||||||
|
|
||||||
|
this->host = host;
|
||||||
|
this->port = port;
|
||||||
|
|
||||||
|
connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
|
||||||
|
this, SLOT(socketStateChanged(QAbstractSocket::SocketState)));
|
||||||
|
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||||
|
this, SLOT(socketError(QAbstractSocket::SocketError)));
|
||||||
|
connect(socket, SIGNAL(readyRead()),
|
||||||
|
this, SLOT(socketReadyRead()));
|
||||||
|
}
|
||||||
|
|
||||||
|
SmtpClient::~SmtpClient() {}
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
void SmtpClient::setUser(const QString &user)
|
||||||
|
{
|
||||||
|
this->user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmtpClient::setPassword(const QString &password)
|
||||||
|
{
|
||||||
|
this->password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmtpClient::setAuthMethod(AuthMethod method)
|
||||||
|
{
|
||||||
|
this->authMethod = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmtpClient::setHost(QString &host)
|
||||||
|
{
|
||||||
|
this->host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmtpClient::setPort(int port)
|
||||||
|
{
|
||||||
|
this->port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmtpClient::setConnectionType(ConnectionType ct)
|
||||||
|
{
|
||||||
|
if (ct == TcpConnection)
|
||||||
|
this->useSsl = false;
|
||||||
|
else if (ct == SslConnection)
|
||||||
|
this->useSsl = true;
|
||||||
|
|
||||||
|
if (useSsl == false)
|
||||||
|
socket = new QTcpSocket(this);
|
||||||
|
else
|
||||||
|
socket = new QSslSocket(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString& SmtpClient::getHost() const
|
||||||
|
{
|
||||||
|
return this->host;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString& SmtpClient::getUser() const
|
||||||
|
{
|
||||||
|
return this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString& SmtpClient::getPassword() const
|
||||||
|
{
|
||||||
|
return this->password;
|
||||||
|
}
|
||||||
|
|
||||||
|
SmtpClient::AuthMethod SmtpClient::getAuthMethod() const
|
||||||
|
{
|
||||||
|
return this->authMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SmtpClient::getPort() const
|
||||||
|
{
|
||||||
|
return this->port;
|
||||||
|
}
|
||||||
|
|
||||||
|
SmtpClient::ConnectionType SmtpClient::getConnectionType() const
|
||||||
|
{
|
||||||
|
if (useSsl)
|
||||||
|
return SslConnection;
|
||||||
|
else
|
||||||
|
return TcpConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [3] Public methods */
|
||||||
|
|
||||||
|
bool SmtpClient::connectToHost()
|
||||||
|
{
|
||||||
|
if (useSsl)
|
||||||
|
((QSslSocket*) socket)->connectToHostEncrypted(host, port);
|
||||||
|
else
|
||||||
|
socket->connectToHost(host, port);
|
||||||
|
|
||||||
|
// Tries to connect to server
|
||||||
|
if (!socket->waitForConnected(connectionTimeout))
|
||||||
|
{
|
||||||
|
emit smtpError(ConnectionTimeoutError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Wait for the server's response
|
||||||
|
waitForResponse();
|
||||||
|
|
||||||
|
// If the response code is not 220 (Service ready)
|
||||||
|
// means that is something wrong with the server
|
||||||
|
if (responseCode != 220)
|
||||||
|
{
|
||||||
|
emit smtpError(ServerError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send a EHLO/HELO message to the server
|
||||||
|
// The client's first command must be EHLO/HELO
|
||||||
|
sendMessage("EHLO SmtpClient for Qt/C++");
|
||||||
|
|
||||||
|
// Wait for the server's response
|
||||||
|
waitForResponse();
|
||||||
|
|
||||||
|
// The response code needs to be 250.
|
||||||
|
if (responseCode != 250)
|
||||||
|
{
|
||||||
|
emit smtpError(ServerError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ResponseTimeoutException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no errors occured the function returns true.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SmtpClient::login()
|
||||||
|
{
|
||||||
|
return login(user, password, authMethod);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SmtpClient::login(const QString &user, const QString &password, AuthMethod method)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (method == AuthPlain)
|
||||||
|
{
|
||||||
|
// Sending command: AUTH PLAIN base64('\0' + username + '\0' + password)
|
||||||
|
sendMessage("AUTH PLAIN " + QByteArray().append((char) 0).append(user).append((char) 0).append(password).toBase64());
|
||||||
|
|
||||||
|
// Wait for the server's response
|
||||||
|
waitForResponse();
|
||||||
|
|
||||||
|
// If the response is not 235 then the authification was faild
|
||||||
|
if (responseCode != 235)
|
||||||
|
{
|
||||||
|
emit smtpError(AuthentificationFailedError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (method == AuthLogin)
|
||||||
|
{
|
||||||
|
// Sending command: AUTH LOGIN
|
||||||
|
sendMessage("AUTH LOGIN");
|
||||||
|
|
||||||
|
// Wait for 334 response code
|
||||||
|
waitForResponse();
|
||||||
|
if (responseCode != 334) { emit smtpError(AuthentificationFailedError); return false; }
|
||||||
|
|
||||||
|
// Send the username in base64
|
||||||
|
sendMessage(QByteArray().append(user).toBase64());
|
||||||
|
|
||||||
|
// Wait for 334
|
||||||
|
waitForResponse();
|
||||||
|
if (responseCode != 334) { emit smtpError(AuthentificationFailedError); return false; }
|
||||||
|
|
||||||
|
// Send the password in base64
|
||||||
|
sendMessage(QByteArray().append(password).toBase64());
|
||||||
|
|
||||||
|
// Wait for the server's responce
|
||||||
|
waitForResponse();
|
||||||
|
|
||||||
|
// If the response is not 235 then the authification was faild
|
||||||
|
if (responseCode != 235)
|
||||||
|
{
|
||||||
|
emit smtpError(AuthentificationFailedError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ResponseTimeoutException e)
|
||||||
|
{
|
||||||
|
// Responce Timeout exceeded
|
||||||
|
emit smtpError(AuthentificationFailedError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SmtpClient::sendMail(MimeMessage& email)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Send the MAIL command with the sender
|
||||||
|
sendMessage("MAIL FROM: <" + email.getSender().getAddress() + ">");
|
||||||
|
|
||||||
|
waitForResponse();
|
||||||
|
|
||||||
|
if (responseCode != 250) return false;
|
||||||
|
|
||||||
|
// Send RCPT command for each recipient
|
||||||
|
for (int i = 0; i < email.getRecipients().size(); ++i)
|
||||||
|
{
|
||||||
|
sendMessage("RCPT TO: <" + email.getRecipients().at(i)->getAddress() + ">");
|
||||||
|
waitForResponse();
|
||||||
|
|
||||||
|
if (responseCode != 250) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send DATA command
|
||||||
|
sendMessage("DATA");
|
||||||
|
waitForResponse();
|
||||||
|
|
||||||
|
if (responseCode != 354) return false;
|
||||||
|
|
||||||
|
sendMessage(email.toString());
|
||||||
|
|
||||||
|
// Send \n.\n to end the mail data
|
||||||
|
sendMessage(".");
|
||||||
|
|
||||||
|
waitForResponse();
|
||||||
|
|
||||||
|
if (responseCode != 250) return false;
|
||||||
|
}
|
||||||
|
catch (ResponseTimeoutException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmtpClient::quit()
|
||||||
|
{
|
||||||
|
sendMessage("QUIT");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [4] Protected methods */
|
||||||
|
|
||||||
|
void SmtpClient::waitForResponse() throw (ResponseTimeoutException)
|
||||||
|
{
|
||||||
|
if (!socket->waitForReadyRead(responseTimeout))
|
||||||
|
{
|
||||||
|
emit smtpError(ResponseTimeoutError);
|
||||||
|
throw ResponseTimeoutException();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the server's response
|
||||||
|
responseText = socket->readAll();
|
||||||
|
|
||||||
|
// Extract the respose code from the server's responce (first 3 digits)
|
||||||
|
responseCode = responseText.left(3).toInt();
|
||||||
|
|
||||||
|
if (responseCode / 100 == 4)
|
||||||
|
emit smtpError(ServerError);
|
||||||
|
|
||||||
|
if (responseCode / 100 == 5)
|
||||||
|
emit smtpError(ClientError);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmtpClient::sendMessage(const QString &text)
|
||||||
|
{
|
||||||
|
socket->write(text.toUtf8() + "\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [4] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [5] Slots for the socket's signals */
|
||||||
|
|
||||||
|
void SmtpClient::socketStateChanged(QAbstractSocket::SocketState state)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmtpClient::socketError(QAbstractSocket::SocketError socketError)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmtpClient::socketReadyRead()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [5] --- */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
140
smtpclient.h
Normal file
140
smtpclient.h
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
#ifndef SMTPCLIENT_H
|
||||||
|
#define SMTPCLIENT_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtNetwork/QSslSocket>
|
||||||
|
|
||||||
|
#include "mimemessage.h"
|
||||||
|
|
||||||
|
|
||||||
|
class SmtpClient : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/* [0] Enumerations */
|
||||||
|
|
||||||
|
enum AuthMethod
|
||||||
|
{
|
||||||
|
AuthPlain,
|
||||||
|
AuthLogin
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SmtpError
|
||||||
|
{
|
||||||
|
ConnectionTimeoutError,
|
||||||
|
ResponseTimeoutError,
|
||||||
|
AuthentificationFailedError,
|
||||||
|
ServerError, // 4xx smtp error
|
||||||
|
ClientError // 5xx smtp error
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ConnectionType
|
||||||
|
{
|
||||||
|
TcpConnection,
|
||||||
|
SslConnection
|
||||||
|
};
|
||||||
|
|
||||||
|
/* [0] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
|
SmtpClient(QString host = "locahost", int port = 25, ConnectionType ct = TcpConnection);
|
||||||
|
|
||||||
|
~SmtpClient();
|
||||||
|
|
||||||
|
/* [1] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [2] Getters and Setters */
|
||||||
|
|
||||||
|
const QString& getHost() const;
|
||||||
|
void setHost(QString &host);
|
||||||
|
|
||||||
|
int getPort() const;
|
||||||
|
void setPort(int port);
|
||||||
|
|
||||||
|
ConnectionType getConnectionType() const;
|
||||||
|
void setConnectionType(ConnectionType ct);
|
||||||
|
|
||||||
|
const QString & getUser() const;
|
||||||
|
void setUser(const QString &host);
|
||||||
|
|
||||||
|
const QString & getPassword() const;
|
||||||
|
void setPassword(const QString &password);
|
||||||
|
|
||||||
|
SmtpClient::AuthMethod getAuthMethod() const;
|
||||||
|
void setAuthMethod(AuthMethod method);
|
||||||
|
|
||||||
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [3] Public methods */
|
||||||
|
|
||||||
|
bool connectToHost();
|
||||||
|
|
||||||
|
bool login();
|
||||||
|
bool login(const QString &user, const QString &password, AuthMethod method = AuthLogin);
|
||||||
|
|
||||||
|
bool sendMail(MimeMessage& email);
|
||||||
|
|
||||||
|
void quit();
|
||||||
|
|
||||||
|
/* [3] --- */
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/* [4] Protected members */
|
||||||
|
|
||||||
|
QTcpSocket *socket;
|
||||||
|
|
||||||
|
QString host;
|
||||||
|
int port;
|
||||||
|
bool useSsl;
|
||||||
|
|
||||||
|
QString user;
|
||||||
|
QString password;
|
||||||
|
AuthMethod authMethod;
|
||||||
|
|
||||||
|
int connectionTimeout;
|
||||||
|
int responseTimeout;
|
||||||
|
|
||||||
|
QString responseText;
|
||||||
|
int responseCode;
|
||||||
|
|
||||||
|
class ResponseTimeoutException {};
|
||||||
|
|
||||||
|
/* [4] --- */
|
||||||
|
|
||||||
|
|
||||||
|
/* [5] Protected methods */
|
||||||
|
|
||||||
|
void waitForResponse() throw (ResponseTimeoutException);
|
||||||
|
|
||||||
|
void sendMessage(const QString &text);
|
||||||
|
|
||||||
|
/* [5] --- */
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
|
||||||
|
/* [6] Protected slots */
|
||||||
|
|
||||||
|
void socketStateChanged(QAbstractSocket::SocketState state);
|
||||||
|
void socketError(QAbstractSocket::SocketError error);
|
||||||
|
void socketReadyRead();
|
||||||
|
|
||||||
|
/* [6] --- */
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
/* [7] Signals */
|
||||||
|
|
||||||
|
void smtpError(SmtpError e);
|
||||||
|
|
||||||
|
/* [7] --- */
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SMTPCLIENT_H
|
Loading…
Reference in New Issue
Block a user