-
Notifications
You must be signed in to change notification settings - Fork 0
Nova implementação para envio de e-mail #10
base: master
Are you sure you want to change the base?
Conversation
imozart
commented
Nov 18, 2020
- Nova implementação para envio de e-mail com Delphi
- Novo README.md para framework Mail
- Testes unitários para envio de email
Adiciona a interface Mail para envio de emails.
Adiciona MailBase para implementação do envio de email
Adiciona um README.md para o framework Mail a fim de explicar o funcionamento
Framework para envio de email + README.md + testes unitários
begin | ||
for i := 0 to Pred(GetCcRecipients.Count) do | ||
begin | ||
with AMsg.CCList.Add do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vamos usar o with mesmo? Não vale a pena evitar não?
body := TIdText.Create(AMsg.MessageParts); | ||
body.Body.Text := GetMessages.Text; | ||
body.ContentType := 'text/plain'; | ||
if IsWithHTML then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talvez trocar a variável por HaveHtmlContent, ou IsHtmlFormat. Ficou meio vago esse nome.
try | ||
if IsWithAuthentication then | ||
begin | ||
smtp.Authenticate; | ||
end; | ||
smtp.Send(msg); | ||
finally | ||
smtp.Disconnect; | ||
end; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acredito que aqui a gente pode mesclar os dois Try..Finally, e eliminar esse interno, levando o SMTP.Disconnect
pra dentro do Finally abaixo.
function IsWithSSL: Boolean; | ||
function IsWithTLS: Boolean; | ||
function IsWithAuthentication: Boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No caso das variáveis IsWithConfirmation, IsWithAuthentication, IsWithSSL e IsWithTLS acho que podemos tirar o Is, porque fica redundante.
function GetAttachments: TStringList; | ||
function GetSubject: string; | ||
function GetMessages: TStringList; | ||
function IsWithHTML: Boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talvez trocar a variável por HaveHtmlContent, ou IsHtmlFormat. Ficou meio vago esse nome.