Giter Site home page Giter Site logo

sendemail-delphi's Introduction

datalogger


SendEmail

Function to send email for Delphi.

Support: [email protected]

⏩ Here is an example Samples

⚠️ Usage

📗 Mode: Simple

uses
  SendEmail;

begin
  TSendEmail.New
    .From('Email', 'Name')
    .AddTo('Email', 'Name')
    .AddReceiptRecipient('Email', 'Name') // Confirmation Read
    .AddReplyTo('Email', 'Name')          // Answer to
    .AddCC('Email', 'Name')
    .AddBCC('Email', 'Name')
    .Priority(TPriority.mpNormal)
    .Subject('My Text with SendEmail')
    .Message('<h1>Message</h1>', True) // True is Default = Text in HTML
    .AddAttachment('')
    .Host('[email protected]')
    .Port(587)
    .Auth(True)
    .UserName('username')
    .Password('password')
    .SSL(False)
    .TLS(False)
    .Send(True); // True is Default = After sending it will be disconnected
end.

📙 Mode: With logger

uses
  SendEmail;

begin
  TSendEmail.New
    .OnLog(
    procedure(ALog: string)
    begin
      Writeln(Format('%s ' + ALog, [FormatDateTime('dd/mm/yyyy hh:MM:ss', Now)]));
    end,
    TLogMode.lmLib) // Options: lmComponent, lmLib, lmAll, lmNone
    .From('Email', 'Name')
    .AddTo('Email', 'Name')
    .AddReceiptRecipient('Email', 'Name') // Confirmation Read
    .AddReplyTo('Email', 'Name')          // Answer to
    .AddCC('Email', 'Name')
    .AddBCC('Email', 'Name')
    .Priority(TPriority.mpNormal)
    .Subject('My Text with SendEmail')
    .Message('<h1>Message</h1>', True) // True is Default = Text in HTML
    .AddAttachment('')
    .Host('[email protected]')
    .Port(587)
    .Auth(True)
    .UserName('username')
    .Password('password')
    .SSL(False)
    .TLS(False)
    .Send(True); // True is Default = After sending it will be disconnected
end. 

📕 Mode: With progress bar

uses
  SendEmail;

begin
  TSendEmail.New
    .OnWorkBegin(
    procedure(ACountMax: Int64)
    begin
      ProgressBar.Max := ACountMax;
      ProgressBar.Position := 0;
      ProgressBar.Refresh;
    end)
    .OnWork(
    procedure(ACount: Int64)
    begin
      ProgressBar.Position := ACount;
      ProgressBar.Refresh;
    end)
    .OnWorkEnd(
    procedure
    begin
      ProgressBar.Position := ProgressBar.Max;
      ProgressBar.Refresh;
    end)
    .From('Email', 'Name')
    .AddTo('Email', 'Name')
    .AddReceiptRecipient('Email', 'Name') // Confirmation Read
    .AddReplyTo('Email', 'Name')          // Answer to
    .AddCC('Email', 'Name')
    .AddBCC('Email', 'Name')
    .Priority(TPriority.mpNormal)
    .Subject('My Text with SendEmail')
    .Message('<h1>Message</h1>', True) // True is Default = Text in HTML
    .AddAttachment('')
    .Host('[email protected]')
    .Port(587)
    .Auth(True)
    .UserName('username')
    .Password('password')
    .SSL(False)
    .TLS(False)
    .Send(True); // True is Default = After sending it will be disconnected
end.

📔 Send asynchronous mode

uses
  SendEmail;

begin
  TSendEmail.New
    .From('Email', 'Name')
    .AddTo('Email', 'Name')
    .AddReceiptRecipient('Email', 'Name') // Confirmation Read
    .AddReplyTo('Email', 'Name')          // Answer to
    .AddCC('Email', 'Name')
    .AddBCC('Email', 'Name')
    .Priority(TPriority.mpNormal)
    .Subject('My Text with SendEmail')
    .Message('<h1>Message</h1>', True) // True is Default = Text in HTML
    .AddAttachment('')
    .Host('[email protected]')
    .Port(587)
    .Auth(True)
    .UserName('username')
    .Password('password')
    .SSL(False)
    .TLS(False)
    .SendAsync(
    procedure(AErro: Boolean; AMessageErro: string) // Informed callback to return
    begin
      if AErro then
        ShowMessage(AMessageErro)
      else
        ShowMessage('Message sent!')
    end, True); // True is Default = After sending it will be disconnected
end.

📡 Host SMTP

Name Host Port Cryptography Auth
Gmail smtp.gmail.com 465 SSL/TLS Yes
Outlook or Office 365 smtp.office365.com 587 TLS Yes
Hotmail smtp.live.com 587 TLS Yes
Yahoo smtp.mail.yahoo.com.br 587 TLS Yes
SendGrid smtp.sendgrid.net 465 TLS Yes
LocalWeb email-ssl.com.br 465 TLS Yes
SparkPost smtp.sparkpostmail.com 587 TLS Yes
Elastic Email smtp.elasticemail.com 587 None Yes
Mail smtp.mail.ru 465 SSL/TLS Yes

sendemail-delphi's People

Contributors

dliocode avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.