Sendemail
Function to send email for Delphi.
Install / Use
/learn @dliocode/SendemailREADME
SendEmail
Function to send email for Delphi.
Support: developer.dlio@gmail.com
:fast_forward: Here is an example Samples
:warning: Usage
:green_book: 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@domain.com')
.Port(587)
.Auth(True)
.UserName('username')
.Password('password')
.SSL(False)
.TLS(False)
.Send(True); // True is Default = After sending it will be disconnected
end.
:orange_book: 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@domain.com')
.Port(587)
.Auth(True)
.UserName('username')
.Password('password')
.SSL(False)
.TLS(False)
.Send(True); // True is Default = After sending it will be disconnected
end.
:closed_book: 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@domain.com')
.Port(587)
.Auth(True)
.UserName('username')
.Password('password')
.SSL(False)
.TLS(False)
.Send(True); // True is Default = After sending it will be disconnected
end.
:notebook_with_decorative_cover: 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@domain.com')
.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.
:satellite: 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 |
Related Skills
node-connect
353.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
353.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
353.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
