diff --git a/README.md b/README.md index 818fe84..5f9ae10 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,33 @@ boss install github.com/juliosenha/mail4delphi 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* ``` ../mail4delphi/src +``` + +## Getting Started +```pascal +uses Mail4Delphi; +``` +## Send email +```pascal +begin + TMail.New + .AddFrom('from', 'name') + .SSL(true) + .Host('host') + .Port(443) + .Auth(true) + .UserName('user') + .Password('pass') + .ReceiptRecipient(false) + .AddCC('cc', 'name') + .AddBCC('cco', 'name') + .AddTo('to', 'name') + .AddSubject('subject') + .AddBody('message') + .AddAttachment(nil) + .SendMail; +end; ``` ## Samples @@ -24,4 +50,8 @@ Check out our sample project for each situation presented above in operation. If ![Mail4Delphi](img/Screenshot_1.png) -> *Alone we go faster. Together we go further.* +## License + +`Mail4Delphi` is free and open-source software licensed under the [MIT License](https://github.com/juliosenha/mail4delphi/blob/master/LICENSE). + +:point_right: *Alone we go faster. Together we go further.* diff --git a/samples/Samples.dpr b/samples/Samples.dpr index 8091e01..7d1b7fc 100644 --- a/samples/Samples.dpr +++ b/samples/Samples.dpr @@ -2,7 +2,9 @@ program Samples; uses Vcl.Forms, - View.Samples in 'scr\view\View.Samples.pas' {FrmSamples}; + View.Samples in 'src\view\View.Samples.pas' {FrmSamples}, + Mail4Delphi in '..\src\Mail4Delphi.pas', + Mail4Delphi.Intf in '..\src\Mail4Delphi.Intf.pas'; {$R *.res} diff --git a/samples/Samples.dproj b/samples/Samples.dproj index a7f8d39..893f3c2 100644 --- a/samples/Samples.dproj +++ b/samples/Samples.dproj @@ -58,7 +58,7 @@ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png Samples - $(DCC_UnitSearchPath);modules\.dcp;modules\.dcu;modules;modules\mail4delphi\samples\scr\view;modules\mail4delphi\scr + 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) Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -83,6 +83,8 @@ false true PerMonitorV2 + true + 1033 false @@ -98,9 +100,12 @@ MainSource - +
FrmSamples
+ dfm
+ + Cfg_2 Base @@ -121,6 +126,11 @@ Samples.dpr + + Embarcadero DBExpress DataSnap Native Server Components + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + diff --git a/samples/Samples.res b/samples/Samples.res new file mode 100644 index 0000000..613d27b Binary files /dev/null and b/samples/Samples.res differ diff --git a/samples/boss.json b/samples/boss.json deleted file mode 100644 index 5d818b4..0000000 --- a/samples/boss.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "mail4delphi", - "description": "", - "version": "1.0.0", - "homepage": "", - "mainsrc": "./", - "projects": [], - "dependencies": { - "github.com/juliosenha/mail4delphi": "^1.0.2" - } -} \ No newline at end of file diff --git a/samples/scr/view/View.Samples.dfm b/samples/src/view/View.Samples.dfm similarity index 84% rename from samples/scr/view/View.Samples.dfm rename to samples/src/view/View.Samples.dfm index 754c3ee..5bd8f13 100644 --- a/samples/scr/view/View.Samples.dfm +++ b/samples/src/view/View.Samples.dfm @@ -1,469 +1,469 @@ -object FrmSamples: TFrmSamples - Left = 0 - Top = 0 - Caption = 'Samples' - ClientHeight = 451 - ClientWidth = 1002 - Color = clWhite - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Tahoma' - Font.Style = [] - OldCreateOrder = False - Position = poOwnerFormCenter - PixelsPerInch = 96 - TextHeight = 13 - object Panel2: TPanel - AlignWithMargins = True - Left = 3 - Top = 3 - Width = 480 - Height = 445 - Align = alLeft - BevelOuter = bvNone - ParentBackground = False - TabOrder = 0 - DesignSize = ( - 480 - 445) - object Label3: TLabel - Left = 10 - Top = 83 - Width = 74 - Height = 13 - Caption = 'Email de Envio' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label5: TLabel - Left = 10 - Top = 129 - Width = 73 - Height = 13 - Caption = 'Servidor SMTP' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label6: TLabel - Left = 357 - Top = 129 - Width = 27 - Height = 13 - Anchors = [akTop, akRight] - Caption = 'Porta' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label7: TLabel - Left = 357 - Top = 83 - Width = 72 - Height = 13 - Anchors = [akTop, akRight] - Caption = 'Criptografada' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label16: TLabel - Left = 10 - Top = 175 - Width = 40 - Height = 13 - Caption = 'Usu'#225'rio' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label17: TLabel - Left = 284 - Top = 175 - Width = 32 - Height = 13 - Anchors = [akTop, akRight] - Caption = 'Senha' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label1: TLabel - Left = 402 - Top = 129 - Width = 67 - Height = 13 - Anchors = [akTop, akRight] - Caption = 'Autentica'#231#227'o' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label4: TLabel - Left = 9 - Top = 37 - Width = 30 - Height = 13 - Caption = 'Nome' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object cbCriptocrafia: TComboBox - Left = 357 - Top = 102 - Width = 112 - Height = 21 - Anchors = [akTop, akRight] - ItemIndex = 0 - TabOrder = 2 - Text = 'SSL' - Items.Strings = ( - 'SSL' - 'TSL') - end - object edtUserName: TEdit - Left = 10 - Top = 194 - Width = 269 - Height = 21 - CharCase = ecLowerCase - TabOrder = 6 - end - object edtPassword: TEdit - Left = 285 - Top = 194 - Width = 185 - Height = 21 - PasswordChar = '*' - TabOrder = 7 - end - object edtHost: TEdit - Left = 10 - Top = 148 - Width = 341 - Height = 21 - CharCase = ecLowerCase - TabOrder = 3 - end - object edtPort: TEdit - Left = 357 - Top = 148 - Width = 40 - Height = 21 - CharCase = ecLowerCase - TabOrder = 4 - end - object edtFrom: TEdit - Left = 10 - Top = 102 - Width = 341 - Height = 21 - CharCase = ecLowerCase - TabOrder = 1 - end - object cbAuth: TComboBox - Left = 403 - Top = 148 - Width = 67 - Height = 21 - Anchors = [akTop, akRight] - ItemIndex = 0 - TabOrder = 5 - Text = 'N'#227'o' - Items.Strings = ( - 'N'#227'o' - 'Sim') - end - object edtNameFrom: TEdit - Left = 10 - Top = 56 - Width = 459 - Height = 21 - Anchors = [akLeft, akTop, akRight] - TabOrder = 0 - end - object chkReceiptRecipient: TCheckBox - Left = 10 - Top = 228 - Width = 201 - Height = 17 - Caption = 'Solicitar Confirma'#231#227'o de Leitura' - TabOrder = 8 - end - object pnlHeaderConfiguracaoEmail: TPanel - Left = 0 - Top = 0 - Width = 480 - Height = 21 - Align = alTop - Alignment = taLeftJustify - BevelOuter = bvNone - Caption = ' Configura'#231#227'o' - Color = 7039851 - Font.Charset = ANSI_CHARSET - Font.Color = clWhite - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [fsBold] - ParentBackground = False - ParentFont = False - TabOrder = 9 - end - end - object Panel3: TPanel - AlignWithMargins = True - Left = 489 - Top = 3 - Width = 510 - Height = 445 - Align = alClient - BevelOuter = bvNone - ParentBackground = False - TabOrder = 1 - DesignSize = ( - 510 - 445) - object Label2: TLabel - Left = 10 - Top = 180 - Width = 42 - Height = 13 - Caption = 'Assunto' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label18: TLabel - Left = 10 - Top = 36 - Width = 93 - Height = 13 - Caption = 'Email Destinat'#225'rio' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label19: TLabel - Left = 255 - Top = 36 - Width = 30 - Height = 13 - Caption = 'Nome' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label8: TLabel - Left = 10 - Top = 83 - Width = 14 - Height = 13 - Caption = 'CC' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label9: TLabel - Left = 255 - Top = 83 - Width = 86 - Height = 13 - Caption = 'Nome (Opcional)' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label10: TLabel - Left = 10 - Top = 132 - Width = 23 - Height = 13 - Caption = 'CCO' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label11: TLabel - Left = 255 - Top = 129 - Width = 86 - Height = 13 - Caption = 'Nome (Opcional)' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object Label12: TLabel - Left = 10 - Top = 307 - Width = 56 - Height = 13 - Caption = 'Mensagem' - Font.Charset = ANSI_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [] - ParentFont = False - end - object edtTo: TEdit - Left = 10 - Top = 55 - Width = 239 - Height = 21 - CharCase = ecLowerCase - TabOrder = 0 - end - object mmBody: TMemo - Left = 10 - Top = 326 - Width = 489 - Height = 71 - TabOrder = 3 - end - object edtNameTo: TEdit - Left = 255 - Top = 55 - Width = 245 - Height = 21 - Anchors = [akLeft, akTop, akRight] - TabOrder = 1 - end - object edtSubject: TEdit - Left = 10 - Top = 199 - Width = 490 - Height = 21 - Anchors = [akLeft, akTop, akRight] - TabOrder = 2 - end - object Panel1: TPanel - Left = 0 - Top = 0 - Width = 510 - Height = 21 - Align = alTop - Alignment = taLeftJustify - BevelOuter = bvNone - Caption = ' Destinat'#225'rio' - Color = 7039851 - Font.Charset = ANSI_CHARSET - Font.Color = clWhite - Font.Height = -11 - Font.Name = 'Segoe UI' - Font.Style = [fsBold] - ParentBackground = False - ParentFont = False - TabOrder = 4 - end - object edtCc: TEdit - Left = 10 - Top = 102 - Width = 239 - Height = 21 - CharCase = ecLowerCase - TabOrder = 5 - end - object edtNomeCc: TEdit - Left = 255 - Top = 102 - Width = 245 - Height = 21 - Anchors = [akLeft, akTop, akRight] - TabOrder = 6 - end - object edtCco: TEdit - Left = 10 - Top = 151 - Width = 239 - Height = 21 - CharCase = ecLowerCase - TabOrder = 7 - end - object edtNomeCco: TEdit - Left = 255 - Top = 151 - Width = 245 - Height = 21 - Anchors = [akLeft, akTop, akRight] - TabOrder = 8 - end - object lbAnexo: TListBox - Left = 10 - Top = 233 - Width = 489 - Height = 49 - Color = clBtnFace - ItemHeight = 13 - MultiSelect = True - TabOrder = 9 - OnKeyDown = lbAnexoKeyDown - end - object btnEnviar: TButton - Left = 338 - Top = 403 - Width = 161 - Height = 30 - Caption = 'Enviar' - TabOrder = 10 - OnClick = btnEnviarClick - end - object btnAnexar: TButton - Left = 416 - Top = 288 - Width = 83 - Height = 25 - Caption = 'Anexar' - TabOrder = 11 - OnClick = btnAnexarClick - end - end -end +object FrmSamples: TFrmSamples + Left = 0 + Top = 0 + Caption = 'Samples' + ClientHeight = 451 + ClientWidth = 1002 + Color = clWhite + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + Position = poOwnerFormCenter + PixelsPerInch = 96 + TextHeight = 13 + object Panel2: TPanel + AlignWithMargins = True + Left = 3 + Top = 3 + Width = 480 + Height = 445 + Align = alLeft + BevelOuter = bvNone + ParentBackground = False + TabOrder = 0 + DesignSize = ( + 480 + 445) + object Label3: TLabel + Left = 10 + Top = 83 + Width = 27 + Height = 13 + Caption = 'Email' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label5: TLabel + Left = 10 + Top = 129 + Width = 62 + Height = 13 + Caption = 'Server SMTP' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label6: TLabel + Left = 357 + Top = 129 + Width = 21 + Height = 13 + Anchors = [akTop, akRight] + Caption = 'Port' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label7: TLabel + Left = 357 + Top = 83 + Width = 72 + Height = 13 + Anchors = [akTop, akRight] + Caption = 'Criptografada' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label16: TLabel + Left = 10 + Top = 175 + Width = 23 + Height = 13 + Caption = 'User' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label17: TLabel + Left = 284 + Top = 175 + Width = 49 + Height = 13 + Anchors = [akTop, akRight] + Caption = 'Password' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label1: TLabel + Left = 402 + Top = 129 + Width = 25 + Height = 13 + Anchors = [akTop, akRight] + Caption = 'Auth' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label4: TLabel + Left = 9 + Top = 37 + Width = 29 + Height = 13 + Caption = 'Name' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object cbCriptocrafia: TComboBox + Left = 357 + Top = 102 + Width = 112 + Height = 21 + Anchors = [akTop, akRight] + ItemIndex = 0 + TabOrder = 2 + Text = 'SSL' + Items.Strings = ( + 'SSL' + 'TSL') + end + object edtUser: TEdit + Left = 10 + Top = 194 + Width = 269 + Height = 21 + CharCase = ecLowerCase + TabOrder = 6 + end + object edtPassword: TEdit + Left = 285 + Top = 194 + Width = 185 + Height = 21 + PasswordChar = '*' + TabOrder = 7 + end + object edtHost: TEdit + Left = 10 + Top = 148 + Width = 341 + Height = 21 + CharCase = ecLowerCase + TabOrder = 3 + end + object edtPort: TEdit + Left = 357 + Top = 148 + Width = 40 + Height = 21 + CharCase = ecLowerCase + TabOrder = 4 + end + object edtFrom: TEdit + Left = 10 + Top = 102 + Width = 341 + Height = 21 + CharCase = ecLowerCase + TabOrder = 1 + end + object cbAuth: TComboBox + Left = 403 + Top = 148 + Width = 67 + Height = 21 + Anchors = [akTop, akRight] + ItemIndex = 0 + TabOrder = 5 + Text = 'No' + Items.Strings = ( + 'No' + 'Yes') + end + object edtNameFrom: TEdit + Left = 10 + Top = 56 + Width = 459 + Height = 21 + Anchors = [akLeft, akTop, akRight] + TabOrder = 0 + end + object chkReceiptRecipient: TCheckBox + Left = 10 + Top = 228 + Width = 143 + Height = 17 + Caption = 'Request read confirmation' + TabOrder = 8 + end + object pnlHeaderEmailConfiguration: TPanel + Left = 0 + Top = 0 + Width = 480 + Height = 21 + Align = alTop + Alignment = taLeftJustify + BevelOuter = bvNone + Caption = ' Configuration' + Color = 7039851 + Font.Charset = ANSI_CHARSET + Font.Color = clWhite + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [fsBold] + ParentBackground = False + ParentFont = False + TabOrder = 9 + end + end + object Panel3: TPanel + AlignWithMargins = True + Left = 489 + Top = 3 + Width = 510 + Height = 445 + Align = alClient + BevelOuter = bvNone + ParentBackground = False + TabOrder = 1 + DesignSize = ( + 510 + 445) + object Label2: TLabel + Left = 10 + Top = 180 + Width = 38 + Height = 13 + Caption = 'Subject' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label18: TLabel + Left = 10 + Top = 36 + Width = 27 + Height = 13 + Caption = 'Email' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label19: TLabel + Left = 255 + Top = 36 + Width = 29 + Height = 13 + Caption = 'Name' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label8: TLabel + Left = 10 + Top = 83 + Width = 14 + Height = 13 + Caption = 'CC' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label9: TLabel + Left = 255 + Top = 83 + Width = 82 + Height = 13 + Caption = 'Name (optional)' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label10: TLabel + Left = 10 + Top = 132 + Width = 23 + Height = 13 + Caption = 'CCO' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label11: TLabel + Left = 255 + Top = 129 + Width = 82 + Height = 13 + Caption = 'Name (optional)' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object Label12: TLabel + Left = 10 + Top = 307 + Width = 45 + Height = 13 + Caption = 'Message' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [] + ParentFont = False + end + object edtTo: TEdit + Left = 10 + Top = 55 + Width = 239 + Height = 21 + CharCase = ecLowerCase + TabOrder = 0 + end + object mmMessage: TMemo + Left = 10 + Top = 326 + Width = 489 + Height = 71 + TabOrder = 3 + end + object edtNameTo: TEdit + Left = 255 + Top = 55 + Width = 245 + Height = 21 + Anchors = [akLeft, akTop, akRight] + TabOrder = 1 + end + object edtSubject: TEdit + Left = 10 + Top = 199 + Width = 490 + Height = 21 + Anchors = [akLeft, akTop, akRight] + TabOrder = 2 + end + object Panel1: TPanel + Left = 0 + Top = 0 + Width = 510 + Height = 21 + Align = alTop + Alignment = taLeftJustify + BevelOuter = bvNone + Caption = ' Recipient' + Color = 7039851 + Font.Charset = ANSI_CHARSET + Font.Color = clWhite + Font.Height = -11 + Font.Name = 'Segoe UI' + Font.Style = [fsBold] + ParentBackground = False + ParentFont = False + TabOrder = 4 + end + object edtCc: TEdit + Left = 10 + Top = 102 + Width = 239 + Height = 21 + CharCase = ecLowerCase + TabOrder = 5 + end + object edtNameCc: TEdit + Left = 255 + Top = 102 + Width = 245 + Height = 21 + Anchors = [akLeft, akTop, akRight] + TabOrder = 6 + end + object edtCco: TEdit + Left = 10 + Top = 151 + Width = 239 + Height = 21 + CharCase = ecLowerCase + TabOrder = 7 + end + object edtNameCco: TEdit + Left = 255 + Top = 151 + Width = 245 + Height = 21 + Anchors = [akLeft, akTop, akRight] + TabOrder = 8 + end + object lbAttachment: TListBox + Left = 10 + Top = 233 + Width = 489 + Height = 49 + Color = clBtnFace + ItemHeight = 13 + MultiSelect = True + TabOrder = 9 + OnKeyDown = lbAttachmentKeyDown + end + object btnSend: TButton + Left = 338 + Top = 403 + Width = 161 + Height = 30 + Caption = 'Send' + TabOrder = 10 + OnClick = btnSendClick + end + object btnAttachment: TButton + Left = 416 + Top = 288 + Width = 83 + Height = 25 + Caption = 'Attachment' + TabOrder = 11 + OnClick = btnAttachmentClick + end + end +end diff --git a/samples/scr/view/View.Samples.pas b/samples/src/view/View.Samples.pas similarity index 56% rename from samples/scr/view/View.Samples.pas rename to samples/src/view/View.Samples.pas index e8dd931..352971a 100644 --- a/samples/scr/view/View.Samples.pas +++ b/samples/src/view/View.Samples.pas @@ -2,9 +2,8 @@ interface -uses - Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, - Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Mail4Delphi.Intf, Mail4Delphi.Default; +uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, + Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Mail4Delphi.Intf, Mail4Delphi; type TFrmSamples = class(TForm) @@ -18,7 +17,7 @@ TFrmSamples = class(TForm) Label1: TLabel; Label4: TLabel; cbCriptocrafia: TComboBox; - edtUserName: TEdit; + edtUser: TEdit; edtPassword: TEdit; edtHost: TEdit; edtPort: TEdit; @@ -26,7 +25,7 @@ TFrmSamples = class(TForm) cbAuth: TComboBox; edtNameFrom: TEdit; chkReceiptRecipient: TCheckBox; - pnlHeaderConfiguracaoEmail: TPanel; + pnlHeaderEmailConfiguration: TPanel; Panel3: TPanel; Label2: TLabel; Label18: TLabel; @@ -37,28 +36,27 @@ TFrmSamples = class(TForm) Label11: TLabel; Label12: TLabel; edtTo: TEdit; - mmBody: TMemo; + mmMessage: TMemo; edtNameTo: TEdit; edtSubject: TEdit; Panel1: TPanel; edtCc: TEdit; - edtNomeCc: TEdit; + edtNameCc: TEdit; edtCco: TEdit; - edtNomeCco: TEdit; - lbAnexo: TListBox; - btnEnviar: TButton; - btnAnexar: TButton; - procedure btnAnexarClick(Sender: TObject); - procedure btnEnviarClick(Sender: TObject); - procedure lbAnexoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + edtNameCco: TEdit; + lbAttachment: TListBox; + btnSend: TButton; + btnAttachment: TButton; + procedure btnAttachmentClick(Sender: TObject); + procedure btnSendClick(Sender: TObject); + procedure lbAttachmentKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); end; implementation {$R *.dfm} - -procedure TFrmSamples.btnAnexarClick(Sender: TObject); +procedure TFrmSamples.btnAttachmentClick(Sender: TObject); var LOpenDialog: TFileOpenDialog; begin @@ -67,13 +65,13 @@ procedure TFrmSamples.btnAnexarClick(Sender: TObject); LOpenDialog.Options := [fdoAllowMultiSelect]; LOpenDialog.DefaultFolder := ExtractFilePath(Application.ExeName); if LOpenDialog.Execute then - lbAnexo.Items.AddStrings(LOpenDialog.Files); + lbAttachment.Items.AddStrings(LOpenDialog.Files); finally LOpenDialog.Free; end; end; -procedure TFrmSamples.btnEnviarClick(Sender: TObject); +procedure TFrmSamples.btnSendClick(Sender: TObject); var LMail: IMail; I: Integer; @@ -84,30 +82,30 @@ procedure TFrmSamples.btnEnviarClick(Sender: TObject); .Host(edtHost.Text) .Port(StrToInt(edtPort.Text)) .Auth(cbAuth.ItemIndex = 1) - .UserName(edtUserName.Text) + .UserName(edtUser.Text) .Password(edtPassword.Text) .ReceiptRecipient(chkReceiptRecipient.Checked) - .AddCC(edtCc.Text, edtNomeCc.Text) - .AddBCC(edtCco.Text, edtNomeCco.Text) + .AddCC(edtCc.Text, edtNameCc.Text) + .AddBCC(edtCco.Text, edtNameCco.Text) .AddTo(edtTo.Text, edtNameTo.Text) .AddSubject(edtSubject.Text) - .AddBody(mmBody.Text); - if lbAnexo.Items.Count > 0 then - for I := 0 to Pred(lbAnexo.Items.Count) do - LMail.AddAttachment(lbAnexo.Items[I]); + .AddBody(mmMessage.Text); + if lbAttachment.Items.Count > 0 then + for I := 0 to Pred(lbAttachment.Items.Count) do + LMail.AddAttachment(lbAttachment.Items[I]); if LMail.SendMail then - ShowMessage('Email enviado com sucesso!'); + ShowMessage('Email successfully sent'); end; -procedure TFrmSamples.lbAnexoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); +procedure TFrmSamples.lbAttachmentKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); var I: Integer; begin if Key = VK_DELETE then begin - for I := Pred(lbAnexo.Items.Count) downto 0 do - if lbAnexo.Selected[I] then - lbAnexo.Items.Delete(I); + for I := Pred(lbAttachment.Items.Count) downto 0 do + if lbAttachment.Selected[I] then + lbAttachment.Items.Delete(I); end; end; diff --git a/scr/Mail4Delphi.Intf.pas b/src/Mail4Delphi.Intf.pas similarity index 100% rename from scr/Mail4Delphi.Intf.pas rename to src/Mail4Delphi.Intf.pas diff --git a/scr/Mail4Delphi.Default.pas b/src/Mail4Delphi.pas similarity index 99% rename from scr/Mail4Delphi.Default.pas rename to src/Mail4Delphi.pas index abcfc2f..625c549 100644 --- a/scr/Mail4Delphi.Default.pas +++ b/src/Mail4Delphi.pas @@ -1,4 +1,4 @@ -unit Mail4Delphi.Default; +unit Mail4Delphi; interface @@ -6,6 +6,8 @@ interface IdExplicitTLSClientServerBase, System.Variants; type + IMail = Mail4Delphi.Intf.IMail; + TMail = class(TInterfacedObject, IMail) private FIdSSLIOHandlerSocket: TIdSSLIOHandlerSocketOpenSSL;