├── .gitignore
├── LICENSE
├── README.md
├── dll
└── 1.0.2.21.zip
├── img
├── Screenshot_1.png
└── mail.png
├── samples
├── delphi
│ ├── Samples.dpr
│ ├── Samples.dproj
│ ├── Samples.res
│ └── src
│ │ └── view
│ │ ├── View.Samples.dfm
│ │ └── View.Samples.pas
└── lazarus
│ ├── Samples.ico
│ ├── Samples.lpi
│ ├── Samples.lpr
│ ├── Samples.lps
│ ├── Samples.res
│ └── src
│ └── view
│ ├── view.samples.lfm
│ └── view.samples.pas
└── src
├── Mail4Delphi.Intf.pas
└── Mail4Delphi.pas
/.gitignore:
--------------------------------------------------------------------------------
1 | # Uncomment these types if you want even more clean repository. But be careful.
2 | # It can make harm to an existing project source. Read explanations below.
3 | #
4 | # Resource files are binaries containing manifest, project icon and version info.
5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
6 | #*.res
7 | #
8 | # Type library file (binary). In old Delphi versions it should be stored.
9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
10 | #*.tlb
11 | #
12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7.
13 | # Uncomment this if you are not using diagrams or use newer Delphi version.
14 | #*.ddp
15 | #
16 | # Visual LiveBindings file. Added in Delphi XE2.
17 | # Uncomment this if you are not using LiveBindings Designer.
18 | #*.vlb
19 | #
20 | # Deployment Manager configuration file for your project. Added in Delphi XE2.
21 | # Uncomment this if it is not mobile development and you do not use remote debug feature.
22 | #*.deployproj
23 | #
24 | # C++ object files produced when C/C++ Output file generation is configured.
25 | # Uncomment this if you are not using external objects (zlib library for example).
26 | #*.obj
27 | #
28 |
29 | # Delphi compiler-generated binaries (safe to delete)
30 | *.exe
31 | *.dll
32 | *.bpl
33 | *.bpi
34 | *.dcp
35 | *.so
36 | *.apk
37 | *.drc
38 | *.map
39 | *.dres
40 | *.rsm
41 | *.tds
42 | *.dcu
43 | *.lib
44 | *.a
45 | *.o
46 | *.ocx
47 |
48 | # Delphi autogenerated files (duplicated info)
49 | *.cfg
50 | *.hpp
51 | *Resource.rc
52 |
53 | # Delphi local files (user-specific info)
54 | *.local
55 | *.identcache
56 | *.projdata
57 | *.tvsconfig
58 | *.dsk
59 |
60 | # Delphi history and backups
61 | __history/
62 | __recovery/
63 | *.~*
64 |
65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi)
66 | *.stat
67 |
68 | # Boss dependency manager vendor folder https://github.com/HashLoad/boss
69 | modules/
70 |
71 | # Backup folder Lazarus IDE
72 | backup/
73 | lib/
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Julio Senha
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 | 
3 | 
4 | 
5 | 
6 | [](https://github.com/juliosenha/mail4delphi/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3Abug)
7 | 
8 | 
9 | [](https://github.com/juliosenha/mail4delphi/blob/master/license.txt)
10 |
11 |
12 | Mail4Delphi uses the Indy component to send the email.! Compatible with Lazarus/FPC
13 |
14 |
15 |
16 |
17 | [](https://pag.ae/7WrUXFNB3)
18 |
19 | ## Prerequisites
20 | * `[Required]` You need to have the libeay32.dll and ssleay32.dll dynamic library files.
21 |
22 |
23 | ## Boss Installation
24 | * `[Optional]` For ease I recommend using the [**Boss**](https://github.com/HashLoad/boss) (Dependency Manager for Delphi) for installation, simply by running the command below on a terminal (Windows PowerShell for example):
25 | ```
26 | boss install github.com/juliosenha/mail4delphi
27 | ```
28 |
29 | ## Manual Installation
30 | If you choose to install manually, simply add the following folder to your project, in *Project > Options > Resource Compiler > Directories and Conditionals > Include file search path*
31 | ```
32 | ../mail4delphi/src
33 | ```
34 |
35 | ## Getting Started
36 | ```pascal
37 | uses Mail4Delphi;
38 | ```
39 |
40 | ## Send email
41 | ```pascal
42 | begin
43 | TMail.New
44 | .From('from', 'name')
45 | .SSL(true)
46 | .Host('host')
47 | .Port(443)
48 | .Auth(true)
49 | .UserName('user')
50 | .Password('pass')
51 | .ReceiptRecipient(false)
52 | .AddTo('to', 'name')
53 | .AddCC('cc', 'name')
54 | .AddBCC('cco', 'name')
55 | .Subject('subject')
56 | .AddBody('message')
57 | .AddAttachment(nil)
58 | .SendMail;
59 | end;
60 | ```
61 |
62 | ## Samples
63 | Check out our sample project for each situation presented above in operation. If you have any questions or suggestion, please contact, make your pull request or create an issue.
64 |
65 | 
66 |
67 | ## License
68 |
69 | `Mail4Delphi` is free and open-source software licensed under the [MIT License](https://github.com/juliosenha/mail4delphi/blob/master/LICENSE).
70 |
71 | :point_right: *Alone we go faster. Together we go further.*
72 |
--------------------------------------------------------------------------------
/dll/1.0.2.21.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/juliosenha/mail4delphi/9caa6652a27388c474ef2fba561aba6d37df4b10/dll/1.0.2.21.zip
--------------------------------------------------------------------------------
/img/Screenshot_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/juliosenha/mail4delphi/9caa6652a27388c474ef2fba561aba6d37df4b10/img/Screenshot_1.png
--------------------------------------------------------------------------------
/img/mail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/juliosenha/mail4delphi/9caa6652a27388c474ef2fba561aba6d37df4b10/img/mail.png
--------------------------------------------------------------------------------
/samples/delphi/Samples.dpr:
--------------------------------------------------------------------------------
1 | program Samples;
2 |
3 | uses
4 | Vcl.Forms,
5 | View.Samples in 'src\view\View.Samples.pas' {FrmSamples},
6 | Mail4Delphi.Intf in '..\..\src\Mail4Delphi.Intf.pas',
7 | Mail4Delphi in '..\..\src\Mail4Delphi.pas';
8 |
9 | {$R *.res}
10 |
11 | var
12 | FrmSamples: TFrmSamples;
13 |
14 | begin
15 | Application.Initialize;
16 | Application.MainFormOnTaskbar := True;
17 | Application.CreateForm(TFrmSamples, FrmSamples);
18 | Application.Run;
19 | end.
20 |
--------------------------------------------------------------------------------
/samples/delphi/Samples.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {7A4C67FD-8799-4E49-A8B4-E1B62F9BF2C3}
4 | 18.8
5 | VCL
6 | Samples.dpr
7 | True
8 | Debug
9 | Win32
10 | 1
11 | Application
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Base
29 | true
30 |
31 |
32 | true
33 | Cfg_1
34 | true
35 | true
36 |
37 |
38 | true
39 | Base
40 | true
41 |
42 |
43 | true
44 | Cfg_2
45 | true
46 | true
47 |
48 |
49 | .\$(Platform)\$(Config)
50 | .\$(Platform)\$(Config)
51 | false
52 | false
53 | false
54 | false
55 | false
56 | System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)
57 | $(BDS)\bin\delphi_PROJECTICON.ico
58 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
59 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
60 | Samples
61 |
62 |
63 | DBXSqliteDriver;dxFlowChartRS26;dxPSdxMapControlLnkRS26;DBXDb2Driver;vclactnband;dxBarRS26;vclFireDAC;dxFireDACEMFRS26;tethering;dxSpreadSheetInplaceRichEditRS26;FireDACADSDriver;dxSkinVisualStudio2013BlueRS26;dxRichEditCoreRS26;dxPSdxSpreadSheetLnkRS26;dxSkinSharpPlusRS26;FireDACMSSQLDriver;vcltouch;vcldb;svn;dxPSTeeChartRS26;dxSkinFoggyRS26;dxSkinVisualStudio2013DarkRS26;dxSkinOffice2013DarkGrayRS26;dxGDIPlusRS26;dxAuthorizationAgentsRS26;dxPSdxFCLnkRS26;vclib;frxTee26;dxPSLnksRS26;FireDACDBXDriver;cxGridRS26;dxPsPrVwAdvRS26;dxPDFViewerRS26;dxSkinSpringTimeRS26;boss_ide;vclx;dxPScxTLLnkRS26;dxSkinOffice2010BlueRS26;uSynEdit_R2022;dxSkinOffice2016DarkRS26;VCLRESTComponents;dxSkinMoneyTwinsRS26;dxSkinOffice2016ColorfulRS26;fsTee26;dxSkinValentineRS26;dxSkinHighContrastRS26;vclie;bindengine;CloudService;dxmdsRS26;FireDACMySQLDriver;fsIBX26;frx26;dxdborRS26;DataSnapClient;dxSkinOffice2013WhiteRS26;dxFireDACServerModeRS26;bindcompdbx;DBXSybaseASEDriver;IndyIPServer;cxPivotGridRS26;IndySystem;fsADO26;frxDBX26;dxSkinDarkRoomRS26;cxTreeListdxBarPopupMenuRS26;dsnapcon;cxTreeListRS26;dxPScxPivotGridLnkRS26;djsonrt;cxSchedulerRibbonStyleEventEditorRS26;dxPSCoreRS26;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;dxSpreadSheetRS26;dxBarExtItemsRS26;dxPSdxGaugeControlLnkRS26;emshosting;dxSkinLondonLiquidSkyRS26;DBXOdbcDriver;FireDACTDataDriver;FMXTee;dxdbtrRS26;dxRichEditControlCoreRS26;soaprtl;DbxCommonDriver;dxFlowChartAdvancedCustomizeFormRS26;dxSkinLiquidSkyRS26;dxSkinSevenRS26;dxDockingRS26;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;cxLibraryRS26;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;cxDataRS26;dxPScxSchedulerLnkRS26;dxSpreadSheetConditionalFormattingDialogsRS26;appanalytics;dxRibbonCustomizationFormRS26;cxSchedulerGridRS26;IndyIPClient;bindcompvcl;dxSkinVisualStudio2013LightRS26;TeeUI;dxADOEMFRS26;VclSmp;FireDACODBCDriver;dxRibbonRS26;DataSnapIndy10ServerTransport;dxPScxCommonRS26;dxRichEditDocumentModelRS26;DataSnapProviderClient;FireDACMongoDBDriver;dxPScxGridLnkRS26;dxSkinDevExpressDarkStyleRS26;dxSpreadSheetCoreRS26;RESTComponents;dxSkinGlassOceansRS26;DBXInterBaseDriver;dxPScxExtCommonRS26;dxSkinPumpkinRS26;emsclientfiredac;dxSkinXmas2008BlueRS26;DataSnapFireDAC;svnui;frxFD26;dxSkinOffice2007SilverRS26;cxPageControlRS26;dxSkinTheBezierRS26;dxSkinDevExpressStyleRS26;DBXMSSQLDriver;dxRichEditControlRS26;DatasnapConnectorsFreePascal;dxGaugeControlRS26;dxorgcRS26;dxPScxVGridLnkRS26;bindcompfmx;dxSkinOffice2007PinkRS26;DBXOracleDriver;inetdb;dxSkinOffice2007BlueRS26;dxSkinStardustRS26;CEF4Delphi;RaizeComponentsVcl;dxDBXServerModeRS26;dxBarDBNavRS26;dxSkinSilverRS26;dxSkinTheAsphaltWorldRS26;FmxTeeUI;emsedge;RaizeComponentsVclDb;fmx;FireDACIBDriver;fmxdae;dxServerModeRS26;dxLayoutControlRS26;dxWizardControlRS26;dxSkinBlueprintRS26;dxSkiniMaginaryRS26;dxTabbedMDIRS26;fs26;dxEMFRS26;dbexpress;IndyCore;dxComnRS26;frxIntIO26;dsnap;emsclient;DataSnapCommon;uniGUI26Chart;FireDACCommon;dxSkinSharpRS26;DataSnapConnectors;cxSchedulerTreeBrowserRS26;dxADOServerModeRS26;adobe_acrobat;soapserver;dxSkinOffice2007BlackRS26;cxVerticalGridRS26;dxtrmdRS26;FireDACOracleDriver;DBXMySQLDriver;cxEditorsRS26;cxSchedulerRS26;cxSchedulerWebServiceStorageRS26;DBXFirebirdDriver;dxSkinMetropolisDarkRS26;dxSkinOffice2010BlackRS26;dxPSdxLCLnkRS26;FireDACCommonODBC;FireDACCommonDriver;dxMapControlRS26;dxSkinBlackRS26;dxSkinOffice2013LightGrayRS26;frxIntIOIndy26;inet;dxSpellCheckerRS26;dxSkinCoffeeRS26;IndyIPCommon;dxSpreadSheetCoreConditionalFormattingDialogsRS26;vcl;dxPSdxDBOCLnkRS26;frxDB26;dxSkinMetropolisRS26;FireDACDb2Driver;dxSpreadSheetReportDesignerRS26;dxPScxPCProdRS26;dxNavBarRS26;uniGUI26VCL;fsDB26;dxCoreRS26;cxExportRS26;TeeDB;FireDAC;dxThemeRS26;dxHttpIndyRequestRS26;dxPSPrVwRibbonRS26;dxSkinOffice2010SilverRS26;frxe26;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;dxSkinSevenClassicRS26;cxPivotGridChartRS26;dxPSRichEditControlLnkRS26;frxIBX26;dxPSDBTeeChartRS26;ibxpress;Tee;DataSnapServer;ibxbindings;dxPSdxDBTVLnkRS26;vclwinx;FireDACDSDriver;frxADO26;dxOfficeCoreRS26;dxTileControlRS26;dxSkinsCoreRS26;CustomIPTransport;vcldsnap;DOSCommandDR;bindcomp;dxSkinLilianRS26;dxSkinSummer2008RS26;DBXInformixDriver;dxPSdxOCLnkRS26;dxSkinVS2010RS26;dxSkinBlueRS26;dmvcframeworkRT;dbxcds;adortl;dxSkinMcSkinRS26;dxSkinDarkSideRS26;dmvcframeworkDT;dxSpreadSheetCoreDialogsRS26;dxBarExtDBItemsRS26;dsnapxml;dbrtl;IndyProtocols;inetdbxpress;dxSkinOffice2007GreenRS26;dxRichEditInplaceRS26;dxSkinWhiteprintRS26;dxPSdxPDFViewerLnkRS26;dxSkinCaramelRS26;fmxase;$(DCC_UsePackage)
64 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
65 | Debug
66 | true
67 | CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
68 | 1033
69 | $(BDS)\bin\default_app.manifest
70 |
71 |
72 | DBXSqliteDriver;dxFlowChartRS26;dxPSdxMapControlLnkRS26;DBXDb2Driver;vclactnband;dxBarRS26;vclFireDAC;dxFireDACEMFRS26;tethering;dxSpreadSheetInplaceRichEditRS26;FireDACADSDriver;dxSkinVisualStudio2013BlueRS26;dxRichEditCoreRS26;dxPSdxSpreadSheetLnkRS26;dxSkinSharpPlusRS26;FireDACMSSQLDriver;vcltouch;vcldb;dxPSTeeChartRS26;dxSkinFoggyRS26;dxSkinVisualStudio2013DarkRS26;dxSkinOffice2013DarkGrayRS26;dxGDIPlusRS26;dxAuthorizationAgentsRS26;dxPSdxFCLnkRS26;vclib;dxPSLnksRS26;FireDACDBXDriver;cxGridRS26;dxPsPrVwAdvRS26;dxPDFViewerRS26;dxSkinSpringTimeRS26;vclx;dxPScxTLLnkRS26;dxSkinOffice2010BlueRS26;uSynEdit_R2022;dxSkinOffice2016DarkRS26;VCLRESTComponents;dxSkinMoneyTwinsRS26;dxSkinOffice2016ColorfulRS26;dxSkinValentineRS26;dxSkinHighContrastRS26;vclie;bindengine;CloudService;dxmdsRS26;FireDACMySQLDriver;dxdborRS26;DataSnapClient;dxSkinOffice2013WhiteRS26;dxFireDACServerModeRS26;bindcompdbx;DBXSybaseASEDriver;IndyIPServer;cxPivotGridRS26;IndySystem;dxSkinDarkRoomRS26;cxTreeListdxBarPopupMenuRS26;dsnapcon;cxTreeListRS26;dxPScxPivotGridLnkRS26;cxSchedulerRibbonStyleEventEditorRS26;dxPSCoreRS26;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;dxSpreadSheetRS26;dxBarExtItemsRS26;dxPSdxGaugeControlLnkRS26;emshosting;dxSkinLondonLiquidSkyRS26;DBXOdbcDriver;FireDACTDataDriver;FMXTee;dxdbtrRS26;dxRichEditControlCoreRS26;soaprtl;DbxCommonDriver;dxFlowChartAdvancedCustomizeFormRS26;dxSkinLiquidSkyRS26;dxSkinSevenRS26;dxDockingRS26;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;cxLibraryRS26;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;cxDataRS26;dxPScxSchedulerLnkRS26;dxSpreadSheetConditionalFormattingDialogsRS26;appanalytics;dxRibbonCustomizationFormRS26;cxSchedulerGridRS26;IndyIPClient;bindcompvcl;dxSkinVisualStudio2013LightRS26;TeeUI;dxADOEMFRS26;VclSmp;FireDACODBCDriver;dxRibbonRS26;DataSnapIndy10ServerTransport;dxPScxCommonRS26;dxRichEditDocumentModelRS26;DataSnapProviderClient;FireDACMongoDBDriver;dxPScxGridLnkRS26;dxSkinDevExpressDarkStyleRS26;dxSpreadSheetCoreRS26;RESTComponents;dxSkinGlassOceansRS26;DBXInterBaseDriver;dxPScxExtCommonRS26;dxSkinPumpkinRS26;emsclientfiredac;dxSkinXmas2008BlueRS26;DataSnapFireDAC;dxSkinOffice2007SilverRS26;cxPageControlRS26;dxSkinTheBezierRS26;dxSkinDevExpressStyleRS26;DBXMSSQLDriver;dxRichEditControlRS26;DatasnapConnectorsFreePascal;dxGaugeControlRS26;dxorgcRS26;dxPScxVGridLnkRS26;bindcompfmx;dxSkinOffice2007PinkRS26;DBXOracleDriver;inetdb;dxSkinOffice2007BlueRS26;dxSkinStardustRS26;CEF4Delphi;RaizeComponentsVcl;dxDBXServerModeRS26;dxBarDBNavRS26;dxSkinSilverRS26;dxSkinTheAsphaltWorldRS26;FmxTeeUI;emsedge;RaizeComponentsVclDb;fmx;FireDACIBDriver;fmxdae;dxServerModeRS26;dxLayoutControlRS26;dxWizardControlRS26;dxSkinBlueprintRS26;dxSkiniMaginaryRS26;dxTabbedMDIRS26;dxEMFRS26;dbexpress;IndyCore;dxComnRS26;dsnap;emsclient;DataSnapCommon;uniGUI26Chart;FireDACCommon;dxSkinSharpRS26;DataSnapConnectors;cxSchedulerTreeBrowserRS26;dxADOServerModeRS26;soapserver;dxSkinOffice2007BlackRS26;cxVerticalGridRS26;dxtrmdRS26;FireDACOracleDriver;DBXMySQLDriver;cxEditorsRS26;cxSchedulerRS26;cxSchedulerWebServiceStorageRS26;DBXFirebirdDriver;dxSkinMetropolisDarkRS26;dxSkinOffice2010BlackRS26;dxPSdxLCLnkRS26;FireDACCommonODBC;FireDACCommonDriver;dxMapControlRS26;dxSkinBlackRS26;dxSkinOffice2013LightGrayRS26;inet;dxSpellCheckerRS26;dxSkinCoffeeRS26;IndyIPCommon;dxSpreadSheetCoreConditionalFormattingDialogsRS26;vcl;dxPSdxDBOCLnkRS26;dxSkinMetropolisRS26;FireDACDb2Driver;dxSpreadSheetReportDesignerRS26;dxPScxPCProdRS26;dxNavBarRS26;uniGUI26VCL;dxCoreRS26;cxExportRS26;TeeDB;FireDAC;dxThemeRS26;dxHttpIndyRequestRS26;dxPSPrVwRibbonRS26;dxSkinOffice2010SilverRS26;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;dxSkinSevenClassicRS26;cxPivotGridChartRS26;dxPSRichEditControlLnkRS26;dxPSDBTeeChartRS26;ibxpress;Tee;DataSnapServer;ibxbindings;dxPSdxDBTVLnkRS26;vclwinx;FireDACDSDriver;dxOfficeCoreRS26;dxTileControlRS26;dxSkinsCoreRS26;CustomIPTransport;vcldsnap;DOSCommandDR;bindcomp;dxSkinLilianRS26;dxSkinSummer2008RS26;DBXInformixDriver;dxPSdxOCLnkRS26;dxSkinVS2010RS26;dxSkinBlueRS26;dbxcds;adortl;dxSkinMcSkinRS26;dxSkinDarkSideRS26;dxSpreadSheetCoreDialogsRS26;dxBarExtDBItemsRS26;dsnapxml;dbrtl;IndyProtocols;inetdbxpress;dxSkinOffice2007GreenRS26;dxRichEditInplaceRS26;dxSkinWhiteprintRS26;dxPSdxPDFViewerLnkRS26;dxSkinCaramelRS26;fmxase;$(DCC_UsePackage)
73 |
74 |
75 | DEBUG;$(DCC_Define)
76 | true
77 | false
78 | true
79 | true
80 | true
81 |
82 |
83 | false
84 | true
85 | PerMonitorV2
86 | true
87 | 1033
88 |
89 |
90 | false
91 | RELEASE;$(DCC_Define)
92 | 0
93 | 0
94 |
95 |
96 | true
97 | PerMonitorV2
98 |
99 |
100 |
101 | MainSource
102 |
103 |
104 |
105 | dfm
106 |
107 |
108 |
109 |
110 | Cfg_2
111 | Base
112 |
113 |
114 | Base
115 |
116 |
117 | Cfg_1
118 | Base
119 |
120 |
121 |
122 | Delphi.Personality.12
123 | Application
124 |
125 |
126 |
127 | Samples.dpr
128 |
129 |
130 | Embarcadero DBExpress DataSnap Native Server Components
131 | Microsoft Office 2000 Sample Automation Server Wrapper Components
132 | Microsoft Office XP Sample Automation Server Wrapper Components
133 |
134 |
135 |
136 |
137 |
138 | Samples.exe
139 | true
140 |
141 |
142 |
143 |
144 | 1
145 |
146 |
147 | Contents\MacOS
148 | 1
149 |
150 |
151 | 0
152 |
153 |
154 |
155 |
156 | classes
157 | 1
158 |
159 |
160 | classes
161 | 1
162 |
163 |
164 |
165 |
166 | res\xml
167 | 1
168 |
169 |
170 | res\xml
171 | 1
172 |
173 |
174 |
175 |
176 | library\lib\armeabi-v7a
177 | 1
178 |
179 |
180 |
181 |
182 | library\lib\armeabi
183 | 1
184 |
185 |
186 | library\lib\armeabi
187 | 1
188 |
189 |
190 |
191 |
192 | library\lib\armeabi-v7a
193 | 1
194 |
195 |
196 |
197 |
198 | library\lib\mips
199 | 1
200 |
201 |
202 | library\lib\mips
203 | 1
204 |
205 |
206 |
207 |
208 | library\lib\armeabi-v7a
209 | 1
210 |
211 |
212 | library\lib\arm64-v8a
213 | 1
214 |
215 |
216 |
217 |
218 | library\lib\armeabi-v7a
219 | 1
220 |
221 |
222 |
223 |
224 | res\drawable
225 | 1
226 |
227 |
228 | res\drawable
229 | 1
230 |
231 |
232 |
233 |
234 | res\values
235 | 1
236 |
237 |
238 | res\values
239 | 1
240 |
241 |
242 |
243 |
244 | res\values-v21
245 | 1
246 |
247 |
248 | res\values-v21
249 | 1
250 |
251 |
252 |
253 |
254 | res\values
255 | 1
256 |
257 |
258 | res\values
259 | 1
260 |
261 |
262 |
263 |
264 | res\drawable
265 | 1
266 |
267 |
268 | res\drawable
269 | 1
270 |
271 |
272 |
273 |
274 | res\drawable-xxhdpi
275 | 1
276 |
277 |
278 | res\drawable-xxhdpi
279 | 1
280 |
281 |
282 |
283 |
284 | res\drawable-ldpi
285 | 1
286 |
287 |
288 | res\drawable-ldpi
289 | 1
290 |
291 |
292 |
293 |
294 | res\drawable-mdpi
295 | 1
296 |
297 |
298 | res\drawable-mdpi
299 | 1
300 |
301 |
302 |
303 |
304 | res\drawable-hdpi
305 | 1
306 |
307 |
308 | res\drawable-hdpi
309 | 1
310 |
311 |
312 |
313 |
314 | res\drawable-xhdpi
315 | 1
316 |
317 |
318 | res\drawable-xhdpi
319 | 1
320 |
321 |
322 |
323 |
324 | res\drawable-mdpi
325 | 1
326 |
327 |
328 | res\drawable-mdpi
329 | 1
330 |
331 |
332 |
333 |
334 | res\drawable-hdpi
335 | 1
336 |
337 |
338 | res\drawable-hdpi
339 | 1
340 |
341 |
342 |
343 |
344 | res\drawable-xhdpi
345 | 1
346 |
347 |
348 | res\drawable-xhdpi
349 | 1
350 |
351 |
352 |
353 |
354 | res\drawable-xxhdpi
355 | 1
356 |
357 |
358 | res\drawable-xxhdpi
359 | 1
360 |
361 |
362 |
363 |
364 | res\drawable-xxxhdpi
365 | 1
366 |
367 |
368 | res\drawable-xxxhdpi
369 | 1
370 |
371 |
372 |
373 |
374 | res\drawable-small
375 | 1
376 |
377 |
378 | res\drawable-small
379 | 1
380 |
381 |
382 |
383 |
384 | res\drawable-normal
385 | 1
386 |
387 |
388 | res\drawable-normal
389 | 1
390 |
391 |
392 |
393 |
394 | res\drawable-large
395 | 1
396 |
397 |
398 | res\drawable-large
399 | 1
400 |
401 |
402 |
403 |
404 | res\drawable-xlarge
405 | 1
406 |
407 |
408 | res\drawable-xlarge
409 | 1
410 |
411 |
412 |
413 |
414 | res\values
415 | 1
416 |
417 |
418 | res\values
419 | 1
420 |
421 |
422 |
423 |
424 | 1
425 |
426 |
427 | Contents\MacOS
428 | 1
429 |
430 |
431 | 0
432 |
433 |
434 |
435 |
436 | Contents\MacOS
437 | 1
438 | .framework
439 |
440 |
441 | Contents\MacOS
442 | 1
443 | .framework
444 |
445 |
446 | 0
447 |
448 |
449 |
450 |
451 | 1
452 | .dylib
453 |
454 |
455 | 1
456 | .dylib
457 |
458 |
459 | 1
460 | .dylib
461 |
462 |
463 | Contents\MacOS
464 | 1
465 | .dylib
466 |
467 |
468 | Contents\MacOS
469 | 1
470 | .dylib
471 |
472 |
473 | 0
474 | .dll;.bpl
475 |
476 |
477 |
478 |
479 | 1
480 | .dylib
481 |
482 |
483 | 1
484 | .dylib
485 |
486 |
487 | 1
488 | .dylib
489 |
490 |
491 | Contents\MacOS
492 | 1
493 | .dylib
494 |
495 |
496 | Contents\MacOS
497 | 1
498 | .dylib
499 |
500 |
501 | 0
502 | .bpl
503 |
504 |
505 |
506 |
507 | 0
508 |
509 |
510 | 0
511 |
512 |
513 | 0
514 |
515 |
516 | 0
517 |
518 |
519 | 0
520 |
521 |
522 | Contents\Resources\StartUp\
523 | 0
524 |
525 |
526 | Contents\Resources\StartUp\
527 | 0
528 |
529 |
530 | 0
531 |
532 |
533 |
534 |
535 | 1
536 |
537 |
538 | 1
539 |
540 |
541 | 1
542 |
543 |
544 |
545 |
546 | 1
547 |
548 |
549 | 1
550 |
551 |
552 | 1
553 |
554 |
555 |
556 |
557 | 1
558 |
559 |
560 | 1
561 |
562 |
563 | 1
564 |
565 |
566 |
567 |
568 | 1
569 |
570 |
571 | 1
572 |
573 |
574 | 1
575 |
576 |
577 |
578 |
579 | 1
580 |
581 |
582 | 1
583 |
584 |
585 | 1
586 |
587 |
588 |
589 |
590 | 1
591 |
592 |
593 | 1
594 |
595 |
596 | 1
597 |
598 |
599 |
600 |
601 | 1
602 |
603 |
604 | 1
605 |
606 |
607 | 1
608 |
609 |
610 |
611 |
612 | 1
613 |
614 |
615 | 1
616 |
617 |
618 | 1
619 |
620 |
621 |
622 |
623 | 1
624 |
625 |
626 | 1
627 |
628 |
629 | 1
630 |
631 |
632 |
633 |
634 | 1
635 |
636 |
637 | 1
638 |
639 |
640 | 1
641 |
642 |
643 |
644 |
645 | 1
646 |
647 |
648 | 1
649 |
650 |
651 | 1
652 |
653 |
654 |
655 |
656 | 1
657 |
658 |
659 | 1
660 |
661 |
662 | 1
663 |
664 |
665 |
666 |
667 | 1
668 |
669 |
670 | 1
671 |
672 |
673 | 1
674 |
675 |
676 |
677 |
678 | 1
679 |
680 |
681 | 1
682 |
683 |
684 | 1
685 |
686 |
687 |
688 |
689 | 1
690 |
691 |
692 | 1
693 |
694 |
695 | 1
696 |
697 |
698 |
699 |
700 | 1
701 |
702 |
703 | 1
704 |
705 |
706 | 1
707 |
708 |
709 |
710 |
711 | 1
712 |
713 |
714 | 1
715 |
716 |
717 | 1
718 |
719 |
720 |
721 |
722 | 1
723 |
724 |
725 | 1
726 |
727 |
728 | 1
729 |
730 |
731 |
732 |
733 | 1
734 |
735 |
736 | 1
737 |
738 |
739 | 1
740 |
741 |
742 |
743 |
744 | 1
745 |
746 |
747 | 1
748 |
749 |
750 | 1
751 |
752 |
753 |
754 |
755 | 1
756 |
757 |
758 | 1
759 |
760 |
761 | 1
762 |
763 |
764 |
765 |
766 | 1
767 |
768 |
769 | 1
770 |
771 |
772 | 1
773 |
774 |
775 |
776 |
777 | 1
778 |
779 |
780 | 1
781 |
782 |
783 | 1
784 |
785 |
786 |
787 |
788 | 1
789 |
790 |
791 | 1
792 |
793 |
794 | 1
795 |
796 |
797 |
798 |
799 | 1
800 |
801 |
802 | 1
803 |
804 |
805 |
806 |
807 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
808 | 1
809 |
810 |
811 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
812 | 1
813 |
814 |
815 |
816 |
817 | 1
818 |
819 |
820 | 1
821 |
822 |
823 |
824 |
825 | ..\
826 | 1
827 |
828 |
829 | ..\
830 | 1
831 |
832 |
833 |
834 |
835 | 1
836 |
837 |
838 | 1
839 |
840 |
841 | 1
842 |
843 |
844 |
845 |
846 | 1
847 |
848 |
849 | 1
850 |
851 |
852 | 1
853 |
854 |
855 |
856 |
857 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
858 | 1
859 |
860 |
861 |
862 |
863 | ..\
864 | 1
865 |
866 |
867 | ..\
868 | 1
869 |
870 |
871 |
872 |
873 | Contents
874 | 1
875 |
876 |
877 | Contents
878 | 1
879 |
880 |
881 |
882 |
883 | Contents\Resources
884 | 1
885 |
886 |
887 | Contents\Resources
888 | 1
889 |
890 |
891 |
892 |
893 | library\lib\armeabi-v7a
894 | 1
895 |
896 |
897 | library\lib\arm64-v8a
898 | 1
899 |
900 |
901 | 1
902 |
903 |
904 | 1
905 |
906 |
907 | 1
908 |
909 |
910 | 1
911 |
912 |
913 | Contents\MacOS
914 | 1
915 |
916 |
917 | Contents\MacOS
918 | 1
919 |
920 |
921 | 0
922 |
923 |
924 |
925 |
926 | library\lib\armeabi-v7a
927 | 1
928 |
929 |
930 |
931 |
932 | 1
933 |
934 |
935 | 1
936 |
937 |
938 |
939 |
940 | Assets
941 | 1
942 |
943 |
944 | Assets
945 | 1
946 |
947 |
948 |
949 |
950 | Assets
951 | 1
952 |
953 |
954 | Assets
955 | 1
956 |
957 |
958 |
959 |
960 |
961 |
962 |
963 |
964 |
965 |
966 |
967 |
968 |
969 |
970 | True
971 | False
972 |
973 |
974 | 12
975 |
976 |
977 |
978 |
979 |
980 |
--------------------------------------------------------------------------------
/samples/delphi/Samples.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/juliosenha/mail4delphi/9caa6652a27388c474ef2fba561aba6d37df4b10/samples/delphi/Samples.res
--------------------------------------------------------------------------------
/samples/delphi/src/view/View.Samples.dfm:
--------------------------------------------------------------------------------
1 | object FrmSamples: TFrmSamples
2 | Left = 0
3 | Top = 0
4 | Caption = 'Samples'
5 | ClientHeight = 451
6 | ClientWidth = 1002
7 | Color = clWhite
8 | Font.Charset = DEFAULT_CHARSET
9 | Font.Color = clWindowText
10 | Font.Height = -11
11 | Font.Name = 'Tahoma'
12 | Font.Style = []
13 | OldCreateOrder = False
14 | Position = poOwnerFormCenter
15 | PixelsPerInch = 96
16 | TextHeight = 13
17 | object Panel2: TPanel
18 | AlignWithMargins = True
19 | Left = 3
20 | Top = 3
21 | Width = 480
22 | Height = 445
23 | Align = alLeft
24 | BevelOuter = bvNone
25 | ParentBackground = False
26 | TabOrder = 0
27 | DesignSize = (
28 | 480
29 | 445)
30 | object Label3: TLabel
31 | Left = 10
32 | Top = 83
33 | Width = 27
34 | Height = 13
35 | Caption = 'Email'
36 | Font.Charset = ANSI_CHARSET
37 | Font.Color = clWindowText
38 | Font.Height = -11
39 | Font.Name = 'Segoe UI'
40 | Font.Style = []
41 | ParentFont = False
42 | end
43 | object Label5: TLabel
44 | Left = 10
45 | Top = 129
46 | Width = 62
47 | Height = 13
48 | Caption = 'Server SMTP'
49 | Font.Charset = ANSI_CHARSET
50 | Font.Color = clWindowText
51 | Font.Height = -11
52 | Font.Name = 'Segoe UI'
53 | Font.Style = []
54 | ParentFont = False
55 | end
56 | object Label6: TLabel
57 | Left = 357
58 | Top = 129
59 | Width = 21
60 | Height = 13
61 | Anchors = [akTop, akRight]
62 | Caption = 'Port'
63 | Font.Charset = ANSI_CHARSET
64 | Font.Color = clWindowText
65 | Font.Height = -11
66 | Font.Name = 'Segoe UI'
67 | Font.Style = []
68 | ParentFont = False
69 | end
70 | object Label7: TLabel
71 | Left = 357
72 | Top = 83
73 | Width = 51
74 | Height = 13
75 | Anchors = [akTop, akRight]
76 | Caption = 'Encrypted'
77 | Font.Charset = ANSI_CHARSET
78 | Font.Color = clWindowText
79 | Font.Height = -11
80 | Font.Name = 'Segoe UI'
81 | Font.Style = []
82 | ParentFont = False
83 | end
84 | object Label16: TLabel
85 | Left = 10
86 | Top = 175
87 | Width = 23
88 | Height = 13
89 | Caption = 'User'
90 | Font.Charset = ANSI_CHARSET
91 | Font.Color = clWindowText
92 | Font.Height = -11
93 | Font.Name = 'Segoe UI'
94 | Font.Style = []
95 | ParentFont = False
96 | end
97 | object Label17: TLabel
98 | Left = 284
99 | Top = 175
100 | Width = 49
101 | Height = 13
102 | Anchors = [akTop, akRight]
103 | Caption = 'Password'
104 | Font.Charset = ANSI_CHARSET
105 | Font.Color = clWindowText
106 | Font.Height = -11
107 | Font.Name = 'Segoe UI'
108 | Font.Style = []
109 | ParentFont = False
110 | end
111 | object Label1: TLabel
112 | Left = 402
113 | Top = 129
114 | Width = 25
115 | Height = 13
116 | Anchors = [akTop, akRight]
117 | Caption = 'Auth'
118 | Font.Charset = ANSI_CHARSET
119 | Font.Color = clWindowText
120 | Font.Height = -11
121 | Font.Name = 'Segoe UI'
122 | Font.Style = []
123 | ParentFont = False
124 | end
125 | object Label4: TLabel
126 | Left = 9
127 | Top = 36
128 | Width = 29
129 | Height = 13
130 | Caption = 'Name'
131 | Font.Charset = ANSI_CHARSET
132 | Font.Color = clWindowText
133 | Font.Height = -11
134 | Font.Name = 'Segoe UI'
135 | Font.Style = []
136 | ParentFont = False
137 | end
138 | object cbCriptocrafia: TComboBox
139 | Left = 357
140 | Top = 102
141 | Width = 112
142 | Height = 21
143 | Anchors = [akTop, akRight]
144 | ItemIndex = 0
145 | TabOrder = 2
146 | Text = 'SSL'
147 | Items.Strings = (
148 | 'SSL'
149 | 'TSL')
150 | end
151 | object edtUser: TEdit
152 | Left = 10
153 | Top = 194
154 | Width = 269
155 | Height = 21
156 | CharCase = ecLowerCase
157 | TabOrder = 6
158 | end
159 | object edtPassword: TEdit
160 | Left = 285
161 | Top = 194
162 | Width = 184
163 | Height = 21
164 | PasswordChar = '*'
165 | TabOrder = 7
166 | end
167 | object edtHost: TEdit
168 | Left = 10
169 | Top = 148
170 | Width = 341
171 | Height = 21
172 | CharCase = ecLowerCase
173 | TabOrder = 3
174 | end
175 | object edtPort: TEdit
176 | Left = 357
177 | Top = 148
178 | Width = 40
179 | Height = 21
180 | CharCase = ecLowerCase
181 | TabOrder = 4
182 | end
183 | object edtFrom: TEdit
184 | Left = 10
185 | Top = 102
186 | Width = 341
187 | Height = 21
188 | CharCase = ecLowerCase
189 | TabOrder = 1
190 | end
191 | object cbAuth: TComboBox
192 | Left = 403
193 | Top = 148
194 | Width = 66
195 | Height = 21
196 | Anchors = [akTop, akRight]
197 | ItemIndex = 0
198 | TabOrder = 5
199 | Text = 'No'
200 | Items.Strings = (
201 | 'No'
202 | 'Yes')
203 | end
204 | object edtNameFrom: TEdit
205 | Left = 9
206 | Top = 55
207 | Width = 460
208 | Height = 21
209 | Anchors = [akLeft, akTop, akRight]
210 | TabOrder = 0
211 | end
212 | object chkReceiptRecipient: TCheckBox
213 | Left = 10
214 | Top = 228
215 | Width = 143
216 | Height = 17
217 | Caption = 'Request read confirmation'
218 | TabOrder = 8
219 | end
220 | object pnlHeaderEmailConfiguration: TPanel
221 | Left = 0
222 | Top = 0
223 | Width = 480
224 | Height = 21
225 | Align = alTop
226 | Alignment = taLeftJustify
227 | BevelOuter = bvNone
228 | Caption = ' Configuration'
229 | Color = 7039851
230 | Font.Charset = ANSI_CHARSET
231 | Font.Color = clWhite
232 | Font.Height = -11
233 | Font.Name = 'Segoe UI'
234 | Font.Style = [fsBold]
235 | ParentBackground = False
236 | ParentFont = False
237 | TabOrder = 9
238 | end
239 | end
240 | object Panel3: TPanel
241 | AlignWithMargins = True
242 | Left = 489
243 | Top = 3
244 | Width = 510
245 | Height = 445
246 | Align = alClient
247 | BevelOuter = bvNone
248 | ParentBackground = False
249 | TabOrder = 1
250 | DesignSize = (
251 | 510
252 | 445)
253 | object Label2: TLabel
254 | Left = 10
255 | Top = 180
256 | Width = 38
257 | Height = 13
258 | Caption = 'Subject'
259 | Font.Charset = ANSI_CHARSET
260 | Font.Color = clWindowText
261 | Font.Height = -11
262 | Font.Name = 'Segoe UI'
263 | Font.Style = []
264 | ParentFont = False
265 | end
266 | object Label18: TLabel
267 | Left = 10
268 | Top = 36
269 | Width = 27
270 | Height = 13
271 | Caption = 'Email'
272 | Font.Charset = ANSI_CHARSET
273 | Font.Color = clWindowText
274 | Font.Height = -11
275 | Font.Name = 'Segoe UI'
276 | Font.Style = []
277 | ParentFont = False
278 | end
279 | object Label19: TLabel
280 | Left = 255
281 | Top = 36
282 | Width = 29
283 | Height = 13
284 | Caption = 'Name'
285 | Font.Charset = ANSI_CHARSET
286 | Font.Color = clWindowText
287 | Font.Height = -11
288 | Font.Name = 'Segoe UI'
289 | Font.Style = []
290 | ParentFont = False
291 | end
292 | object Label8: TLabel
293 | Left = 10
294 | Top = 83
295 | Width = 14
296 | Height = 13
297 | Caption = 'CC'
298 | Font.Charset = ANSI_CHARSET
299 | Font.Color = clWindowText
300 | Font.Height = -11
301 | Font.Name = 'Segoe UI'
302 | Font.Style = []
303 | ParentFont = False
304 | end
305 | object Label9: TLabel
306 | Left = 255
307 | Top = 83
308 | Width = 82
309 | Height = 13
310 | Caption = 'Name (optional)'
311 | Font.Charset = ANSI_CHARSET
312 | Font.Color = clWindowText
313 | Font.Height = -11
314 | Font.Name = 'Segoe UI'
315 | Font.Style = []
316 | ParentFont = False
317 | end
318 | object Label10: TLabel
319 | Left = 10
320 | Top = 132
321 | Width = 23
322 | Height = 13
323 | Caption = 'CCO'
324 | Font.Charset = ANSI_CHARSET
325 | Font.Color = clWindowText
326 | Font.Height = -11
327 | Font.Name = 'Segoe UI'
328 | Font.Style = []
329 | ParentFont = False
330 | end
331 | object Label11: TLabel
332 | Left = 255
333 | Top = 129
334 | Width = 82
335 | Height = 13
336 | Caption = 'Name (optional)'
337 | Font.Charset = ANSI_CHARSET
338 | Font.Color = clWindowText
339 | Font.Height = -11
340 | Font.Name = 'Segoe UI'
341 | Font.Style = []
342 | ParentFont = False
343 | end
344 | object Label12: TLabel
345 | Left = 10
346 | Top = 307
347 | Width = 45
348 | Height = 13
349 | Caption = 'Message'
350 | Font.Charset = ANSI_CHARSET
351 | Font.Color = clWindowText
352 | Font.Height = -11
353 | Font.Name = 'Segoe UI'
354 | Font.Style = []
355 | ParentFont = False
356 | end
357 | object edtTo: TEdit
358 | Left = 10
359 | Top = 55
360 | Width = 239
361 | Height = 21
362 | CharCase = ecLowerCase
363 | TabOrder = 0
364 | end
365 | object mmMessage: TMemo
366 | Left = 10
367 | Top = 326
368 | Width = 489
369 | Height = 71
370 | TabOrder = 3
371 | end
372 | object edtNameTo: TEdit
373 | Left = 255
374 | Top = 55
375 | Width = 245
376 | Height = 21
377 | Anchors = [akLeft, akTop, akRight]
378 | TabOrder = 1
379 | end
380 | object edtSubject: TEdit
381 | Left = 10
382 | Top = 199
383 | Width = 490
384 | Height = 21
385 | Anchors = [akLeft, akTop, akRight]
386 | TabOrder = 2
387 | Text = 'teste'
388 | end
389 | object Panel1: TPanel
390 | Left = 0
391 | Top = 0
392 | Width = 510
393 | Height = 21
394 | Align = alTop
395 | Alignment = taLeftJustify
396 | BevelOuter = bvNone
397 | Caption = ' Recipient'
398 | Color = 7039851
399 | Font.Charset = ANSI_CHARSET
400 | Font.Color = clWhite
401 | Font.Height = -11
402 | Font.Name = 'Segoe UI'
403 | Font.Style = [fsBold]
404 | ParentBackground = False
405 | ParentFont = False
406 | TabOrder = 4
407 | end
408 | object edtCc: TEdit
409 | Left = 10
410 | Top = 102
411 | Width = 239
412 | Height = 21
413 | CharCase = ecLowerCase
414 | TabOrder = 5
415 | end
416 | object edtNameCc: TEdit
417 | Left = 255
418 | Top = 102
419 | Width = 245
420 | Height = 21
421 | Anchors = [akLeft, akTop, akRight]
422 | TabOrder = 6
423 | end
424 | object edtCco: TEdit
425 | Left = 10
426 | Top = 151
427 | Width = 239
428 | Height = 21
429 | CharCase = ecLowerCase
430 | TabOrder = 7
431 | end
432 | object edtNameCco: TEdit
433 | Left = 255
434 | Top = 151
435 | Width = 245
436 | Height = 21
437 | Anchors = [akLeft, akTop, akRight]
438 | TabOrder = 8
439 | end
440 | object lbAttachment: TListBox
441 | Left = 10
442 | Top = 233
443 | Width = 489
444 | Height = 49
445 | Color = clBtnFace
446 | ItemHeight = 13
447 | MultiSelect = True
448 | TabOrder = 9
449 | OnKeyDown = lbAttachmentKeyDown
450 | end
451 | object btnSend: TButton
452 | Left = 338
453 | Top = 403
454 | Width = 161
455 | Height = 30
456 | Caption = 'Send'
457 | TabOrder = 10
458 | OnClick = btnSendClick
459 | end
460 | object btnAttachment: TButton
461 | Left = 416
462 | Top = 288
463 | Width = 83
464 | Height = 25
465 | Caption = 'Attachment'
466 | TabOrder = 11
467 | OnClick = btnAttachmentClick
468 | end
469 | end
470 | end
471 |
--------------------------------------------------------------------------------
/samples/delphi/src/view/View.Samples.pas:
--------------------------------------------------------------------------------
1 | unit View.Samples;
2 |
3 | interface
4 |
5 | uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms,
6 | Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Mail4Delphi;
7 |
8 | type
9 | TFrmSamples = class(TForm)
10 | Panel2: TPanel;
11 | Label3: TLabel;
12 | Label5: TLabel;
13 | Label6: TLabel;
14 | Label7: TLabel;
15 | Label16: TLabel;
16 | Label17: TLabel;
17 | Label1: TLabel;
18 | Label4: TLabel;
19 | cbCriptocrafia: TComboBox;
20 | edtUser: TEdit;
21 | edtPassword: TEdit;
22 | edtHost: TEdit;
23 | edtPort: TEdit;
24 | edtFrom: TEdit;
25 | cbAuth: TComboBox;
26 | edtNameFrom: TEdit;
27 | chkReceiptRecipient: TCheckBox;
28 | pnlHeaderEmailConfiguration: TPanel;
29 | Panel3: TPanel;
30 | Label2: TLabel;
31 | Label18: TLabel;
32 | Label19: TLabel;
33 | Label8: TLabel;
34 | Label9: TLabel;
35 | Label10: TLabel;
36 | Label11: TLabel;
37 | Label12: TLabel;
38 | edtTo: TEdit;
39 | mmMessage: TMemo;
40 | edtNameTo: TEdit;
41 | edtSubject: TEdit;
42 | Panel1: TPanel;
43 | edtCc: TEdit;
44 | edtNameCc: TEdit;
45 | edtCco: TEdit;
46 | edtNameCco: TEdit;
47 | lbAttachment: TListBox;
48 | btnSend: TButton;
49 | btnAttachment: TButton;
50 | procedure btnAttachmentClick(Sender: TObject);
51 | procedure btnSendClick(Sender: TObject);
52 | procedure lbAttachmentKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
53 | end;
54 |
55 | implementation
56 |
57 | {$R *.dfm}
58 |
59 | procedure TFrmSamples.btnAttachmentClick(Sender: TObject);
60 | var
61 | LOpenDialog: TFileOpenDialog;
62 | begin
63 | LOpenDialog := TFileOpenDialog.Create(Self);
64 | try
65 | LOpenDialog.Options := [fdoAllowMultiSelect];
66 | LOpenDialog.DefaultFolder := ExtractFilePath(Application.ExeName);
67 | if LOpenDialog.Execute then
68 | lbAttachment.Items.AddStrings(LOpenDialog.Files);
69 | finally
70 | LOpenDialog.Free;
71 | end;
72 | end;
73 |
74 | procedure TFrmSamples.btnSendClick(Sender: TObject);
75 | var
76 | LMail: IMail;
77 | I: Integer;
78 | begin
79 | LMail := TMail.New
80 | .From(edtFrom.Text, edtNameFrom.Text)
81 | .SSL(cbCriptocrafia.ItemIndex = 0)
82 | .Host(edtHost.Text)
83 | .Port(StrToInt(edtPort.Text))
84 | .Auth(cbAuth.ItemIndex = 1)
85 | .UserName(edtUser.Text)
86 | .Password(edtPassword.Text)
87 | .ReceiptRecipient(chkReceiptRecipient.Checked)
88 | .AddCC(edtCc.Text, edtNameCc.Text)
89 | .AddBCC(edtCco.Text, edtNameCco.Text)
90 | .AddTo(edtTo.Text, edtNameTo.Text)
91 | .Subject(edtSubject.Text)
92 | .AddBody(mmMessage.Text);
93 | if lbAttachment.Items.Count > 0 then
94 | for I := 0 to Pred(lbAttachment.Items.Count) do
95 | LMail.AddAttachment(lbAttachment.Items[I]);
96 | if LMail.SendMail then
97 | ShowMessage('Email successfully sent');
98 | end;
99 |
100 | procedure TFrmSamples.lbAttachmentKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
101 | var
102 | I: Integer;
103 | begin
104 | if Key = VK_DELETE then
105 | begin
106 | for I := Pred(lbAttachment.Items.Count) downto 0 do
107 | if lbAttachment.Selected[I] then
108 | lbAttachment.Items.Delete(I);
109 | end;
110 | end;
111 |
112 | end.
113 |
--------------------------------------------------------------------------------
/samples/lazarus/Samples.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/juliosenha/mail4delphi/9caa6652a27388c474ef2fba561aba6d37df4b10/samples/lazarus/Samples.ico
--------------------------------------------------------------------------------
/samples/lazarus/Samples.lpi:
--------------------------------------------------------------------------------
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 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/samples/lazarus/Samples.lpr:
--------------------------------------------------------------------------------
1 | program Samples;
2 |
3 | {$mode objfpc}{$H+}
4 |
5 | uses
6 | {$IFDEF UNIX}{$IFDEF UseCThreads}
7 | cthreads,
8 | {$ENDIF}{$ENDIF}
9 | Interfaces,
10 | Forms, indylaz,
11 | View.Samples in 'src\view\View.Samples.pas' {FrmSamples},
12 | Mail4Delphi.Intf in '..\..\src\Mail4Delphi.Intf.pas',
13 | Mail4Delphi in '..\..\src\Mail4Delphi.pas';
14 |
15 | {$R *.res}
16 |
17 | begin
18 | RequireDerivedFormResource:=True;
19 | Application.Scaled:=True;
20 | Application.Initialize;
21 | Application.CreateForm(TFrmSamples, FrmSamples);
22 | Application.Run;
23 | end.
24 |
25 |
--------------------------------------------------------------------------------
/samples/lazarus/Samples.lps:
--------------------------------------------------------------------------------
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 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/samples/lazarus/Samples.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/juliosenha/mail4delphi/9caa6652a27388c474ef2fba561aba6d37df4b10/samples/lazarus/Samples.res
--------------------------------------------------------------------------------
/samples/lazarus/src/view/view.samples.lfm:
--------------------------------------------------------------------------------
1 | object FrmSamples: TFrmSamples
2 | Left = 406
3 | Height = 472
4 | Top = 204
5 | Width = 1018
6 | Caption = 'Samples'
7 | ClientHeight = 472
8 | ClientWidth = 1018
9 | Color = clWhite
10 | OnCreate = FormCreate
11 | Position = poDesktopCenter
12 | LCLVersion = '2.0.10.0'
13 | object Panel1: TPanel
14 | Left = 5
15 | Height = 462
16 | Top = 5
17 | Width = 480
18 | Align = alLeft
19 | Alignment = taLeftJustify
20 | BorderSpacing.Around = 5
21 | BevelOuter = bvNone
22 | ClientHeight = 462
23 | ClientWidth = 480
24 | ParentColor = False
25 | TabOrder = 0
26 | object pnlHeaderEmailConfiguration: TPanel
27 | Left = 0
28 | Height = 21
29 | Top = 0
30 | Width = 480
31 | Align = alTop
32 | Alignment = taLeftJustify
33 | BevelOuter = bvNone
34 | Caption = ' Configuration'
35 | Color = 7039851
36 | Font.CharSet = ANSI_CHARSET
37 | Font.Color = clWhite
38 | Font.Height = -11
39 | Font.Name = 'Segoe UI'
40 | Font.Style = [fsBold]
41 | ParentBackground = False
42 | ParentColor = False
43 | ParentFont = False
44 | TabOrder = 0
45 | end
46 | object Label3: TLabel
47 | Left = 10
48 | Height = 13
49 | Top = 83
50 | Width = 27
51 | Caption = 'Email'
52 | Font.CharSet = ANSI_CHARSET
53 | Font.Color = clWindowText
54 | Font.Height = -11
55 | Font.Name = 'Segoe UI'
56 | ParentColor = False
57 | ParentFont = False
58 | end
59 | object Label5: TLabel
60 | Left = 10
61 | Height = 13
62 | Top = 129
63 | Width = 62
64 | Caption = 'Server SMTP'
65 | Font.CharSet = ANSI_CHARSET
66 | Font.Color = clWindowText
67 | Font.Height = -11
68 | Font.Name = 'Segoe UI'
69 | ParentColor = False
70 | ParentFont = False
71 | end
72 | object Label6: TLabel
73 | Left = 355
74 | Height = 13
75 | Top = 129
76 | Width = 21
77 | Anchors = [akTop, akRight]
78 | Caption = 'Port'
79 | Font.CharSet = ANSI_CHARSET
80 | Font.Color = clWindowText
81 | Font.Height = -11
82 | Font.Name = 'Segoe UI'
83 | ParentColor = False
84 | ParentFont = False
85 | end
86 | object Label7: TLabel
87 | Left = 355
88 | Height = 13
89 | Top = 83
90 | Width = 51
91 | Anchors = [akTop, akRight]
92 | Caption = 'Encrypted'
93 | Font.CharSet = ANSI_CHARSET
94 | Font.Color = clWindowText
95 | Font.Height = -11
96 | Font.Name = 'Segoe UI'
97 | ParentColor = False
98 | ParentFont = False
99 | end
100 | object Label16: TLabel
101 | Left = 10
102 | Height = 13
103 | Top = 180
104 | Width = 23
105 | Caption = 'User'
106 | Font.CharSet = ANSI_CHARSET
107 | Font.Color = clWindowText
108 | Font.Height = -11
109 | Font.Name = 'Segoe UI'
110 | ParentColor = False
111 | ParentFont = False
112 | end
113 | object Label17: TLabel
114 | Left = 285
115 | Height = 13
116 | Top = 180
117 | Width = 49
118 | Anchors = [akTop, akRight]
119 | Caption = 'Password'
120 | Font.CharSet = ANSI_CHARSET
121 | Font.Color = clWindowText
122 | Font.Height = -11
123 | Font.Name = 'Segoe UI'
124 | ParentColor = False
125 | ParentFont = False
126 | end
127 | object Label1: TLabel
128 | Left = 400
129 | Height = 13
130 | Top = 129
131 | Width = 25
132 | Anchors = [akTop, akRight]
133 | Caption = 'Auth'
134 | Font.CharSet = ANSI_CHARSET
135 | Font.Color = clWindowText
136 | Font.Height = -11
137 | Font.Name = 'Segoe UI'
138 | ParentColor = False
139 | ParentFont = False
140 | end
141 | object Label4: TLabel
142 | Left = 9
143 | Height = 13
144 | Top = 36
145 | Width = 29
146 | Caption = 'Name'
147 | Font.CharSet = ANSI_CHARSET
148 | Font.Color = clWindowText
149 | Font.Height = -11
150 | Font.Name = 'Segoe UI'
151 | ParentColor = False
152 | ParentFont = False
153 | end
154 | object cbCriptocrafia: TComboBox
155 | Left = 355
156 | Height = 23
157 | Top = 102
158 | Width = 112
159 | Anchors = [akTop, akRight]
160 | ItemHeight = 15
161 | ItemIndex = 0
162 | Items.Strings = (
163 | 'SSL'
164 | 'TSL'
165 | )
166 | TabOrder = 3
167 | Text = 'SSL'
168 | end
169 | object edtUser: TEdit
170 | Left = 10
171 | Height = 23
172 | Top = 199
173 | Width = 269
174 | CharCase = ecLowerCase
175 | TabOrder = 7
176 | end
177 | object edtPassword: TEdit
178 | Left = 285
179 | Height = 23
180 | Top = 199
181 | Width = 185
182 | EchoMode = emPassword
183 | PasswordChar = '*'
184 | TabOrder = 8
185 | end
186 | object edtHost: TEdit
187 | Left = 10
188 | Height = 23
189 | Top = 151
190 | Width = 341
191 | CharCase = ecLowerCase
192 | TabOrder = 4
193 | end
194 | object edtPort: TEdit
195 | Left = 355
196 | Height = 23
197 | Top = 151
198 | Width = 40
199 | CharCase = ecLowerCase
200 | TabOrder = 5
201 | end
202 | object edtFrom: TEdit
203 | Left = 10
204 | Height = 23
205 | Top = 102
206 | Width = 341
207 | CharCase = ecLowerCase
208 | TabOrder = 2
209 | end
210 | object cbAuth: TComboBox
211 | Left = 400
212 | Height = 23
213 | Top = 151
214 | Width = 67
215 | Anchors = [akTop, akRight]
216 | ItemHeight = 15
217 | ItemIndex = 0
218 | Items.Strings = (
219 | 'No'
220 | 'Yes'
221 | )
222 | TabOrder = 6
223 | Text = 'No'
224 | end
225 | object edtNameFrom: TEdit
226 | Left = 10
227 | Height = 23
228 | Top = 55
229 | Width = 457
230 | Anchors = [akTop, akLeft, akRight]
231 | TabOrder = 1
232 | end
233 | object chkReceiptRecipient: TCheckBox
234 | Left = 10
235 | Height = 19
236 | Top = 227
237 | Width = 160
238 | Caption = 'Request read confirmation'
239 | TabOrder = 9
240 | end
241 | end
242 | object Panel2: TPanel
243 | Left = 490
244 | Height = 462
245 | Top = 5
246 | Width = 523
247 | Align = alClient
248 | Alignment = taLeftJustify
249 | BorderSpacing.Around = 5
250 | BevelOuter = bvNone
251 | ClientHeight = 462
252 | ClientWidth = 523
253 | ParentColor = False
254 | TabOrder = 1
255 | object Panel3: TPanel
256 | Left = 0
257 | Height = 21
258 | Top = 0
259 | Width = 523
260 | Align = alTop
261 | Alignment = taLeftJustify
262 | BevelOuter = bvNone
263 | Caption = ' Recipient'
264 | Color = 7039851
265 | Font.CharSet = ANSI_CHARSET
266 | Font.Color = clWhite
267 | Font.Height = -11
268 | Font.Name = 'Segoe UI'
269 | Font.Style = [fsBold]
270 | ParentBackground = False
271 | ParentColor = False
272 | ParentFont = False
273 | TabOrder = 0
274 | end
275 | object Label2: TLabel
276 | Left = 10
277 | Height = 13
278 | Top = 180
279 | Width = 38
280 | Caption = 'Subject'
281 | Font.CharSet = ANSI_CHARSET
282 | Font.Color = clWindowText
283 | Font.Height = -11
284 | Font.Name = 'Segoe UI'
285 | ParentColor = False
286 | ParentFont = False
287 | end
288 | object Label18: TLabel
289 | Left = 10
290 | Height = 13
291 | Top = 36
292 | Width = 27
293 | Caption = 'Email'
294 | Font.CharSet = ANSI_CHARSET
295 | Font.Color = clWindowText
296 | Font.Height = -11
297 | Font.Name = 'Segoe UI'
298 | ParentColor = False
299 | ParentFont = False
300 | end
301 | object Label19: TLabel
302 | Left = 255
303 | Height = 13
304 | Top = 36
305 | Width = 29
306 | Caption = 'Name'
307 | Font.CharSet = ANSI_CHARSET
308 | Font.Color = clWindowText
309 | Font.Height = -11
310 | Font.Name = 'Segoe UI'
311 | ParentColor = False
312 | ParentFont = False
313 | end
314 | object Label9: TLabel
315 | Left = 255
316 | Height = 13
317 | Top = 83
318 | Width = 82
319 | Caption = 'Name (optional)'
320 | Font.CharSet = ANSI_CHARSET
321 | Font.Color = clWindowText
322 | Font.Height = -11
323 | Font.Name = 'Segoe UI'
324 | ParentColor = False
325 | ParentFont = False
326 | end
327 | object Label10: TLabel
328 | Left = 10
329 | Height = 13
330 | Top = 129
331 | Width = 23
332 | Caption = 'CCO'
333 | Font.CharSet = ANSI_CHARSET
334 | Font.Color = clWindowText
335 | Font.Height = -11
336 | Font.Name = 'Segoe UI'
337 | ParentColor = False
338 | ParentFont = False
339 | end
340 | object Label11: TLabel
341 | Left = 255
342 | Height = 13
343 | Top = 129
344 | Width = 82
345 | Caption = 'Name (optional)'
346 | Font.CharSet = ANSI_CHARSET
347 | Font.Color = clWindowText
348 | Font.Height = -11
349 | Font.Name = 'Segoe UI'
350 | ParentColor = False
351 | ParentFont = False
352 | end
353 | object Label12: TLabel
354 | Left = 10
355 | Height = 13
356 | Top = 307
357 | Width = 45
358 | Caption = 'Message'
359 | Font.CharSet = ANSI_CHARSET
360 | Font.Color = clWindowText
361 | Font.Height = -11
362 | Font.Name = 'Segoe UI'
363 | ParentColor = False
364 | ParentFont = False
365 | end
366 | object edtTo: TEdit
367 | Left = 10
368 | Height = 23
369 | Top = 55
370 | Width = 239
371 | CharCase = ecLowerCase
372 | TabOrder = 1
373 | end
374 | object mmMessage: TMemo
375 | Left = 10
376 | Height = 71
377 | Top = 326
378 | Width = 501
379 | TabOrder = 10
380 | end
381 | object edtNameTo: TEdit
382 | Left = 255
383 | Height = 23
384 | Top = 55
385 | Width = 256
386 | Anchors = [akTop, akLeft, akRight]
387 | TabOrder = 2
388 | end
389 | object edtSubject: TEdit
390 | Left = 10
391 | Height = 23
392 | Top = 199
393 | Width = 501
394 | Anchors = [akTop, akLeft, akRight]
395 | TabOrder = 5
396 | end
397 | object edtCc: TEdit
398 | Left = 10
399 | Height = 23
400 | Top = 102
401 | Width = 239
402 | CharCase = ecLowerCase
403 | TabOrder = 3
404 | end
405 | object edtNameCc: TEdit
406 | Left = 255
407 | Height = 23
408 | Top = 102
409 | Width = 256
410 | Anchors = [akTop, akLeft, akRight]
411 | TabOrder = 4
412 | end
413 | object edtCco: TEdit
414 | Left = 10
415 | Height = 23
416 | Top = 151
417 | Width = 239
418 | CharCase = ecLowerCase
419 | TabOrder = 6
420 | end
421 | object edtNameCco: TEdit
422 | Left = 255
423 | Height = 23
424 | Top = 151
425 | Width = 256
426 | Anchors = [akTop, akLeft, akRight]
427 | TabOrder = 7
428 | end
429 | object lbAttachment: TListBox
430 | Left = 10
431 | Height = 49
432 | Top = 233
433 | Width = 501
434 | Color = clBtnFace
435 | ItemHeight = 0
436 | MultiSelect = True
437 | OnKeyDown = lbAttachmentKeyDown
438 | TabOrder = 8
439 | end
440 | object btnSend: TButton
441 | Left = 350
442 | Height = 30
443 | Top = 404
444 | Width = 161
445 | Caption = 'Send'
446 | OnClick = btnSendClick
447 | TabOrder = 11
448 | end
449 | object btnAttachment: TButton
450 | Left = 428
451 | Height = 25
452 | Top = 288
453 | Width = 83
454 | Caption = 'Attachment'
455 | OnClick = btnAttachmentClick
456 | TabOrder = 9
457 | end
458 | object Label8: TLabel
459 | Left = 10
460 | Height = 13
461 | Top = 83
462 | Width = 14
463 | Caption = 'CC'
464 | Font.CharSet = ANSI_CHARSET
465 | Font.Color = clWindowText
466 | Font.Height = -11
467 | Font.Name = 'Segoe UI'
468 | ParentColor = False
469 | ParentFont = False
470 | end
471 | end
472 | end
473 |
--------------------------------------------------------------------------------
/samples/lazarus/src/view/view.samples.pas:
--------------------------------------------------------------------------------
1 | unit View.Samples;
2 |
3 | {$mode objfpc}{$H+}
4 |
5 | interface
6 |
7 | uses
8 | Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, Mail4Delphi, LCLType;
9 |
10 | type
11 |
12 | TFrmSamples = class(TForm)
13 | btnAttachment: TButton;
14 | btnSend: TButton;
15 | cbAuth: TComboBox;
16 | cbCriptocrafia: TComboBox;
17 | chkReceiptRecipient: TCheckBox;
18 | edtCc: TEdit;
19 | edtCco: TEdit;
20 | edtFrom: TEdit;
21 | edtHost: TEdit;
22 | edtNameCc: TEdit;
23 | edtNameCco: TEdit;
24 | edtNameFrom: TEdit;
25 | edtNameTo: TEdit;
26 | edtPassword: TEdit;
27 | edtPort: TEdit;
28 | edtSubject: TEdit;
29 | edtTo: TEdit;
30 | edtUser: TEdit;
31 | Label1: TLabel;
32 | Label10: TLabel;
33 | Label11: TLabel;
34 | Label12: TLabel;
35 | Label16: TLabel;
36 | Label17: TLabel;
37 | Label18: TLabel;
38 | Label19: TLabel;
39 | Label2: TLabel;
40 | Label3: TLabel;
41 | Label4: TLabel;
42 | Label5: TLabel;
43 | Label6: TLabel;
44 | Label7: TLabel;
45 | Label8: TLabel;
46 | Label9: TLabel;
47 | lbAttachment: TListBox;
48 | mmMessage: TMemo;
49 | Panel1: TPanel;
50 | Panel2: TPanel;
51 | Panel3: TPanel;
52 | pnlHeaderEmailConfiguration: TPanel;
53 | procedure btnAttachmentClick(Sender: TObject);
54 | procedure btnSendClick(Sender: TObject);
55 | procedure lbAttachmentKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
56 | end;
57 |
58 | var
59 | FrmSamples: TFrmSamples;
60 |
61 | implementation
62 |
63 | {$R *.lfm}
64 |
65 | procedure TFrmSamples.lbAttachmentKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
66 | var
67 | I: Integer;
68 | begin
69 | if Key = VK_DELETE then
70 | begin
71 | for I := Pred(lbAttachment.Items.Count) downto 0 do
72 | if lbAttachment.Selected[I] then
73 | lbAttachment.Items.Delete(I);
74 | end;
75 | end;
76 |
77 | procedure TFrmSamples.btnAttachmentClick(Sender: TObject);
78 | var
79 | LOpenDialog: TOpenDialog ;
80 | begin
81 | LOpenDialog := TOpenDialog .Create(Self);
82 | try
83 | LOpenDialog.Options := [ofAllowMultiSelect];
84 | LOpenDialog.InitialDir := ExtractFilePath(Application.ExeName);
85 | if LOpenDialog.Execute then
86 | lbAttachment.Items.AddStrings(LOpenDialog.Files);
87 | finally
88 | LOpenDialog.Free;
89 | end;
90 | end;
91 |
92 | procedure TFrmSamples.btnSendClick(Sender: TObject);
93 | var
94 | LMail: IMail;
95 | I: Integer;
96 | begin
97 | LMail := TMail.New
98 | .From(edtFrom.Text, edtNameFrom.Text)
99 | .SSL(cbCriptocrafia.ItemIndex = 0)
100 | .Host(edtHost.Text)
101 | .Port(StrToInt(edtPort.Text))
102 | .Auth(cbAuth.ItemIndex = 1)
103 | .UserName(edtUser.Text)
104 | .Password(edtPassword.Text)
105 | .ReceiptRecipient(chkReceiptRecipient.Checked)
106 | .AddCC(edtCc.Text, edtNameCc.Text)
107 | .AddBCC(edtCco.Text, edtNameCco.Text)
108 | .AddTo(edtTo.Text, edtNameTo.Text)
109 | .Subject(edtSubject.Text)
110 | .AddBody(mmMessage.Text);
111 | if lbAttachment.Items.Count > 0 then
112 | for I := 0 to Pred(lbAttachment.Items.Count) do
113 | LMail.AddAttachment(lbAttachment.Items[I]);
114 | if LMail.SendMail then
115 | ShowMessage('Email successfully sent');
116 | end;
117 |
118 | end.
119 |
120 |
--------------------------------------------------------------------------------
/src/Mail4Delphi.Intf.pas:
--------------------------------------------------------------------------------
1 | unit Mail4Delphi.Intf;
2 |
3 | interface
4 |
5 | uses
6 | {$IF DEFINED(FPC)}
7 | Classes;
8 | {$ELSE}
9 | System.Classes;
10 | {$ENDIF}
11 |
12 | type
13 | IMail = interface
14 | ['{A63918AD-EA2C-4CB9-98C5-90C3BAB95144}']
15 | function AddTo(const AMail: string; const AName: string = ''): IMail;
16 | function From(const AMail: string; const AName: string = ''): IMail;
17 | function ReceiptRecipient(const AValue: Boolean): IMail;
18 | function Subject(const ASubject: string): IMail;
19 | function AddReplyTo(const AMail: string; const AName: string = ''): IMail;
20 | function AddCC(const AMail: string; const AName: string = ''): IMail;
21 | function AddBCC(const AMail: string; const AName: string = ''): IMail;
22 | function MessageId(const AMessageId: string): IMail;
23 | function AddBody(const ABody: string): IMail;
24 | function ClearBody: IMail;
25 | function ClearAttachments: IMail;
26 | function Host(const AHost: string): IMail;
27 | function UserName(const AUserName: string): IMail;
28 | function Password(const APassword: string): IMail;
29 | function Port(const APort: Integer): IMail;
30 | function AddAttachment(const AFile: string; ATemporaryFile: Boolean = False): IMail; overload;
31 | function AddAttachment(const AStream: TStream; const AFileName: string; const AContentType: string = ''): IMail; overload;
32 | function Auth(const AValue: Boolean): IMail;
33 | function SSL(const AValue: Boolean): IMail;
34 | function ContentType(const AValue: string): IMail;
35 | function ConnectTimeout(const ATimeout: Integer): IMail;
36 | function ReadTimeout(const ATimeout: Integer): IMail;
37 | function Clear: IMail;
38 | function SendMail: Boolean;
39 | function SetUpEmail: Boolean;
40 | function Connect: Boolean;
41 | function Disconnect: Boolean;
42 | end;
43 |
44 | implementation
45 |
46 | end.
47 |
--------------------------------------------------------------------------------
/src/Mail4Delphi.pas:
--------------------------------------------------------------------------------
1 | unit Mail4Delphi;
2 |
3 | {$IF DEFINED(FPC)}
4 | {$MODE DELPHI}{$H+}
5 | {$ENDIF}
6 |
7 | interface
8 |
9 | uses
10 | {$IF DEFINED(FPC)}
11 | Classes, SysUtils, Variants,
12 | {$ELSE}
13 | System.Classes, System.SysUtils, System.Variants,
14 | {$ENDIF}
15 | IdSMTP, IdSSLOpenSSL, IdMessage, IdMessageParts, IdText, IdAttachmentFile, IdExplicitTLSClientServerBase, Mail4Delphi.Intf;
16 |
17 | type
18 | IMail = Mail4Delphi.Intf.IMail;
19 |
20 | TMail = class(TInterfacedObject, IMail)
21 | private const
22 | CONNECT_TIMEOUT = 60000;
23 | READ_TIMEOUT = 60000;
24 | private
25 | FIdSSLIOHandlerSocket: TIdSSLIOHandlerSocketOpenSSL;
26 | FIdSMTP: TIdSMTP;
27 | FIdMessage: TIdMessage;
28 | FIdText: TIdText;
29 | FSSL: Boolean;
30 | FAuth: Boolean;
31 | FReceiptRecipient: Boolean;
32 | FMessageId: string;
33 | function AddTo(const AMail: string; const AName: string = ''): IMail;
34 | function From(const AMail: string; const AName: string = ''): IMail;
35 | function ReceiptRecipient(const AValue: Boolean): IMail;
36 | function Subject(const ASubject: string): IMail;
37 | function AddReplyTo(const AMail: string; const AName: string = ''): IMail;
38 | function AddCC(const AMail: string; const AName: string = ''): IMail;
39 | function AddBCC(const AMail: string; const AName: string = ''): IMail;
40 | function AddBody(const ABody: string): IMail;
41 | function MessageId(const AMessageId: string): IMail;
42 | function ClearBody: IMail;
43 | function ClearAttachments: IMail;
44 | function Host(const AHost: string): IMail;
45 | function UserName(const AUserName: string): IMail;
46 | function Password(const APassword: string): IMail;
47 | function Port(const APort: Integer): IMail;
48 | function AddAttachment(const AFile: string; ATemporaryFile: Boolean = False): IMail; overload;
49 | function AddAttachment(const AStream: TStream; const AFileName: string; const AContentType: string = ''): IMail; overload;
50 | function Auth(const AValue: Boolean): IMail;
51 | function SSL(const AValue: Boolean): IMail;
52 | function ContentType(const AValue: string): IMail;
53 | function ConnectTimeout(const ATimeout: Integer): IMail;
54 | function ReadTimeout(const ATimeout: Integer): IMail;
55 | function Clear: IMail;
56 | function SendMail: Boolean;
57 | function SetUpEmail: Boolean;
58 | function Connect: Boolean;
59 | function Disconnect: Boolean;
60 | function MessageDefault: IMail;
61 | protected
62 | property IdSSLIOHandlerSocket: TIdSSLIOHandlerSocketOpenSSL read FIdSSLIOHandlerSocket write FIdSSLIOHandlerSocket;
63 | property IdSMTP: TIdSMTP read FIdSMTP write FIdSMTP;
64 | property IdMessage: TIdMessage read FIdMessage write FIdMessage;
65 | property IdText: TIdText read FIdText write FIdText;
66 | property SetSSL: Boolean read FSSL write FSSL;
67 | property SetAuth: Boolean read FAuth write FAuth;
68 | property SetReceiptRecipient: Boolean read FReceiptRecipient write FReceiptRecipient;
69 | public
70 | class function New: IMail;
71 | constructor Create;
72 | destructor Destroy; override;
73 | end;
74 |
75 | implementation
76 |
77 | function TMail.From(const AMail: string; const AName: string = ''): IMail;
78 | begin
79 | if AMail.Trim.IsEmpty then
80 | raise Exception.Create('Sender email not informed!');
81 | FIdMessage.From.Address := AMail.Trim;
82 | FIdMessage.From.Name := AName.Trim;
83 | Result := Self;
84 | end;
85 |
86 | function TMail.AddBCC(const AMail: string; const AName: string = ''): IMail;
87 | begin
88 | Result := Self;
89 | if AMail.Trim.IsEmpty then
90 | Exit;
91 | with FIdMessage.BccList.Add do
92 | begin
93 | Address := AMail.Trim;
94 | Name := AName.Trim;
95 | end;
96 | end;
97 |
98 | function TMail.AddAttachment(const AFile: string; ATemporaryFile: Boolean): IMail;
99 | var
100 | LFile: TIdAttachmentFile;
101 | begin
102 | LFile := TIdAttachmentFile.Create(FIdMessage.MessageParts, AFile);
103 | LFile.ContentDescription := ExtractFileName(AFile);
104 | LFile.FileIsTempFile := ATemporaryFile;
105 | Result := Self;
106 | end;
107 |
108 | function TMail.AddAttachment(const AStream: TStream; const AFileName: string; const AContentType: string): IMail;
109 | var
110 | LFile: TIdAttachmentFile;
111 | begin
112 | AStream.Position := 0;
113 | LFile := TIdAttachmentFile.Create(FIdMessage.MessageParts, AFileName);
114 | LFile.StoredPathName := EmptyStr;
115 | LFile.ContentDescription := AFileName;
116 | if not AContentType.Trim.IsEmpty then
117 | LFile.ContentType := AContentType;
118 | LFile.LoadFromStream(AStream);
119 | Result := Self;
120 | end;
121 |
122 | function TMail.Auth(const AValue: Boolean): IMail;
123 | begin
124 | FAuth := AValue;
125 | Result := Self;
126 | end;
127 |
128 | function TMail.AddBody(const ABody: string): IMail;
129 | begin
130 | FIdText.Body.Add(ABody);
131 | Result := Self;
132 | end;
133 |
134 | function TMail.Host(const AHost: string): IMail;
135 | begin
136 | if AHost.Trim.IsEmpty then
137 | raise Exception.Create('Server not informed!');
138 | FIdSMTP.Host := AHost;
139 | Result := Self;
140 | end;
141 |
142 | function TMail.MessageId(const AMessageId: string): IMail;
143 | begin
144 | FMessageId := AMessageId;
145 | Result := Self;
146 | end;
147 |
148 | function TMail.MessageDefault: IMail;
149 | begin
150 | FIdMessage.Encoding := meMIME;
151 | FIdMessage.ConvertPreamble := True;
152 | FIdMessage.Priority := mpNormal;
153 | FIdMessage.ContentType := 'multipart/mixed';
154 | FIdMessage.CharSet := 'utf-8';
155 | FIdMessage.Date := Now;
156 | Result := Self;
157 | end;
158 |
159 | function TMail.Password(const APassword: string): IMail;
160 | begin
161 | if APassword.Trim.IsEmpty then
162 | raise Exception.Create('Password not informed!');
163 | FIdSMTP.Password := APassword;
164 | Result := Self;
165 | end;
166 |
167 | function TMail.Port(const APort: Integer): IMail;
168 | begin
169 | if VarIsNull(APort) then
170 | raise Exception.Create('Port not informed!');
171 | FIdSMTP.Port := APort;
172 | Result := Self;
173 | end;
174 |
175 | function TMail.ReadTimeout(const ATimeout: Integer): IMail;
176 | begin
177 | if (ATimeout > 0) then
178 | FIdSMTP.ReadTimeout := ATimeout;
179 | Result := Self;
180 | end;
181 |
182 | function TMail.ReceiptRecipient(const AValue: Boolean): IMail;
183 | begin
184 | FReceiptRecipient := AValue;
185 | Result := Self;
186 | end;
187 |
188 | function TMail.SSL(const AValue: Boolean): IMail;
189 | begin
190 | FSSL := AValue;
191 | Result := Self;
192 | end;
193 |
194 | function TMail.AddCC(const AMail: string; const AName: string = ''): IMail;
195 | begin
196 | Result := Self;
197 | if AMail.Trim.IsEmpty then
198 | Exit;
199 | with FIdMessage.CCList.Add do
200 | begin
201 | Address := AMail.Trim;
202 | Name := AName.Trim;
203 | end;
204 | end;
205 |
206 | function TMail.AddReplyTo(const AMail: string; const AName: string = ''): IMail;
207 | begin
208 | Result := Self;
209 | if AMail.Trim.IsEmpty then
210 | Exit;
211 | with FIdMessage.ReplyTo.Add do
212 | begin
213 | Address := AMail.Trim;
214 | Name := AName.Trim;
215 | end;
216 | end;
217 |
218 | function TMail.Subject(const ASubject: string): IMail;
219 | begin
220 | if ASubject.Trim.IsEmpty then
221 | raise Exception.Create('Subject not informed!');
222 | FIdMessage.Subject := ASubject;
223 | Result := Self;
224 | end;
225 |
226 | function TMail.AddTo(const AMail: string; const AName: string = ''): IMail;
227 | begin
228 | if AMail.Trim.IsEmpty then
229 | raise Exception.Create('Recipient email not informed!');
230 | with FIdMessage.Recipients.Add do
231 | begin
232 | Address := AMail.Trim;
233 | Name := AName.Trim;
234 | end;
235 | Result := Self;
236 | end;
237 |
238 | function TMail.Clear: IMail;
239 | begin
240 | FIdMessage.ClearHeader;
241 | Self.MessageDefault;
242 | Self.ClearAttachments;
243 | Self.ClearBody;
244 | Result := Self;
245 | end;
246 |
247 | function TMail.ClearAttachments: IMail;
248 | var
249 | I: Integer;
250 | begin
251 | for I := Pred(FIdMessage.MessageParts.Count) downto 0 do
252 | begin
253 | if FIdMessage.MessageParts.Items[I].PartType = TIdMessagePartType.mptAttachment then
254 | FIdMessage.MessageParts.Delete(I);
255 | end;
256 | Result := Self;
257 | end;
258 |
259 | function TMail.ClearBody: IMail;
260 | begin
261 | FIdText.Body.Clear;
262 | Result := Self;
263 | end;
264 |
265 | function TMail.Connect: Boolean;
266 | begin
267 | FIdSSLIOHandlerSocket.SSLOptions.Method := sslvSSLv23;
268 | FIdSSLIOHandlerSocket.SSLOptions.Mode := sslmUnassigned;
269 | FIdSMTP.IOHandler := FIdSSLIOHandlerSocket;
270 | FIdSMTP.UseTLS := utUseExplicitTLS;
271 | if FSSL then
272 | begin
273 | FIdSSLIOHandlerSocket.SSLOptions.Mode := sslmClient;
274 | FIdSMTP.UseTLS := utUseImplicitTLS;
275 | end;
276 | FIdSMTP.AuthType := satNone;
277 | if FAuth then
278 | FIdSMTP.AuthType := satDefault;
279 | if FReceiptRecipient then
280 | FIdMessage.ReceiptRecipient.Text := FIdMessage.From.Name + ' ' + FIdMessage.From.Address;
281 | try
282 | FIdSMTP.Connect;
283 | except
284 | on E: Exception do
285 | raise Exception.Create('Connection error: ' + E.Message);
286 | end;
287 | try
288 | FIdSMTP.Authenticate;
289 | Result := True;
290 | except
291 | on E: Exception do
292 | begin
293 | Self.Disconnect;
294 | raise Exception.Create('Authentication error:' + E.Message);
295 | end;
296 | end;
297 | end;
298 |
299 | function TMail.ConnectTimeout(const ATimeout: Integer): IMail;
300 | begin
301 | if (ATimeout > 0) then
302 | FIdSMTP.ConnectTimeout := ATimeout;
303 | Result := Self;
304 | end;
305 |
306 | function TMail.ContentType(const AValue: string): IMail;
307 | begin
308 | FIdText.ContentType := AValue;
309 | Result := Self;
310 | end;
311 |
312 | constructor TMail.Create;
313 | begin
314 | FIdSSLIOHandlerSocket := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
315 | FIdSMTP := TIdSMTP.Create(nil);
316 | FIdSMTP.ConnectTimeout := CONNECT_TIMEOUT;
317 | FIdSMTP.ReadTimeout := READ_TIMEOUT;
318 | FIdMessage := TIdMessage.Create(nil);
319 | FIdMessage.Encoding := meMIME;
320 | FIdMessage.ConvertPreamble := True;
321 | FIdMessage.Priority := mpNormal;
322 | FIdMessage.ContentType := 'multipart/mixed';
323 | FIdMessage.CharSet := 'utf-8';
324 | FIdMessage.Date := Now;
325 | FIdText := TIdText.Create(IdMessage.MessageParts);
326 | FIdText.ContentType := 'text/html; text/plain;';
327 | FIdText.CharSet := 'utf-8';
328 | FSSL := False;
329 | FAuth := False;
330 | FReceiptRecipient := False;
331 | FMessageId := EmptyStr;
332 | end;
333 |
334 | destructor TMail.Destroy;
335 | begin
336 | FreeAndNil(FIdMessage);
337 | FreeAndNil(FIdSSLIOHandlerSocket);
338 | FreeAndNil(FIdSMTP);
339 | end;
340 |
341 | function TMail.Disconnect: Boolean;
342 | begin
343 | if FIdSMTP.Connected then
344 | FIdSMTP.Disconnect;
345 | UnLoadOpenSSLLibrary;
346 | Result := True;
347 | end;
348 |
349 | class function TMail.New: IMail;
350 | begin
351 | Result := TMail.Create;
352 | end;
353 |
354 | function TMail.SendMail: Boolean;
355 | var
356 | LImplicitConnection: Boolean;
357 | begin
358 | if not SetUpEmail then
359 | raise Exception.Create('Incomplete data!');
360 | LImplicitConnection := False;
361 | if not FIdSMTP.Connected then
362 | LImplicitConnection := Self.Connect;
363 | try
364 | try
365 | if not FMessageId.Trim.IsEmpty then
366 | FIdMessage.MsgId := FMessageId;
367 | FIdSMTP.Send(FIdMessage);
368 | Result := True;
369 | except
370 | on E: Exception do
371 | raise Exception.Create('Error sending message: ' + E.Message);
372 | end;
373 | finally
374 | if LImplicitConnection then
375 | Self.Disconnect;
376 | end;
377 | end;
378 |
379 | function TMail.SetUpEmail: Boolean;
380 | begin
381 | Result := False;
382 | if not(FIdMessage.Recipients.Count < 1) then
383 | if not(FIdSMTP.Host.Trim.IsEmpty) then
384 | if not(FIdSMTP.UserName.Trim.IsEmpty) then
385 | if not(FIdSMTP.Password.Trim.IsEmpty) then
386 | Result := not(VarIsNull(FIdSMTP.Port));
387 | end;
388 |
389 | function TMail.UserName(const AUserName: string): IMail;
390 | begin
391 | if AUserName.Trim.IsEmpty then
392 | raise Exception.Create('User not informed!');
393 | FIdSMTP.UserName := AUserName;
394 | Result := Self;
395 | end;
396 |
397 | end.
398 |
--------------------------------------------------------------------------------