Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

SimpleMail

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

SimpleMail

SimpleMail is a library to facilitate the sending of messages through SMTP connections.

⚙️ Installation

  • Manual installation: Add the following folders to your project, in Project > Options > Resource Compiler > Directories and Conditionals > Include file search path
pascal
../SimpleMail/src
  • Installation using the Boss:
pascal
boss install github.com/weslleycapelari/SimpleMail

🔰 Engines

By default, the library uses the most up-to-date components, in this case the current one is Indy.

⚡️ Quickstart

You need to use SimpleMail

pascal
uses SimpleMail;
  • Mail Server
pascal
var
  LMailer: IMail;
begin
  LMailer := TMail.New
    .Hostname('smtp.gmail.com')
    .Port(465)
    .Username('example@gmail.com')
    .Password('password')
    .SSL(True)
    .Timeout(10000)
    .Connect;

  if LMailer.IsConnected then
    ShowMessage('Connected')
  else
    ShowMessage('Not Connected');
end;
  • Message
pascal
var
  LMailer : IMail;
  LMessage: IMessage;
begin
  LMailer := TMail.New
    .Hostname('smtp.gmail.com')
    .Port(465)
    .Username('example@gmail.com')
    .Password('password')
    .SSL(True)
    .Timeout(10000)
    .Connect;

  if LMailer.IsConnected then
  begin
    LMessage := LMailer.NewMessage
      .From('example@gmail.com')
      .Recipients('example1@gmail.com;example2@gmail.com')
      .CC('example3@gmail.com;example4@gmail.com')
      .CCo('example5@gmail.com;example6@gmail.com')
      .Subject('Test Email')
      .Body('This is a test message')
      .Send;

    LMailer.SendMessage(LMessage);
  end;
end;

📝 Samples

A project was developed inside the example folder

💻 Code Contributors

⚠️ License

SimpleMail is free and open-source software licensed under the Apache-2.0 License.