Mailer4D is a minimalist Delphi framework to configure a SMTP client and send email messages.
Also natively supports inline (base64) images for html messages.
[Required]
For SSL/TLS support libeay32.dll and ssleay32.dll is required, check out OpenSSL folder.
[Optional]
Boss instalation:
boss install github.com/willisnou/Mailer4D
[Manual]
For manual installation add the ../Mailer4D/src
directory on library path in Tools > Options > Language > Delphi > Library > Library Path or add the files manually to the project in Project > Add to Project... menu.
uses Mailer4D.Mailer;
var
Mailer: IMailer;
begin
Mailer:= TMailer.New;
Mailer.
.Host('smtp.host.com')
.Port(587)
.Username('username@example.com')
.Password('user_password')
.TLS(True)
.Auth(True)
.From('from@example.com', 'from name')
.AddRecipient('recipient@example.com')
.AddCC('cc@example.com')
.AddBCC('cco@example.com')
.ReceiptRecipient(False)
.Subject('email subject')
.AddBody('email body part', 'message part content-type')
.AddAttachment('..\.\attachment.txt')
.Send;
end;
Define a callback of TProc<Boolean>
:
procedure SentStatusCallback(ASent: Boolean);
begin
// TODO
end;
And then use SendAsynch
method with the callback as parameter.
var
Mailer: IMailer;
begin
Mailer:= TMailer.New;
Mailer.
.Host('smtp.host.com')
.Port(587)
.Username('username@example.com')
.Password('user_password')
.TLS(True)
.Auth(True)
.From('from@example.com', 'from name')
.AddRecipient('recipient@example.com')
.AddCC('cc@example.com')
.AddBCC('cco@example.com')
.ReceiptRecipient(False)
.Subject('email subject')
.AddBody('email body part', 'message part content-type')
.AddAttachment('..\.\attachment.txt')
.SendAsynch(SentStatusCallback);
end;
Check out the sample code available with a simple user case.
Issues, questions or suggestions are apreciated.