procedure TfrmMessageEditor.bbtnOkClick(Sender: TObject);
begin
with IdMsgSend
do
begin
Body.Assign(Memo1.Lines);
From.Text := UserEmail;
ReplyTo.EMailAddresses := UserEmail;
Recipients.EMailAddresses := edtTo.Text;
{ To: header }
Subject := edtSubject.Text;
{ Subject: header }
Priority := TIdMessagePriority(cboPriority.ItemIndex);
{ Message Priority }
CCList.EMailAddresses := edtCC.Text;
{CC}
BccList.EMailAddresses := edtBCC.Text;
{BBC}
if chkReturnReciept.Checked
then
begin {We set the recipient to the From E-Mail address }
ReceiptRecipient.Text := From.Text;
end
else
begin {indicate that there is no receipt recipiant}
ReceiptRecipient.Text := '
';
end;
end;
{authentication settings}
case SmtpAuthType
of
0:
SMTP.AuthenticationType := atNone;
1:
SMTP.AuthenticationType := atLogin;
{Simple Login}
end;
SMTP.Username := SmtpServerUser;
SMTP.Password := SmtpServerPassword;
{General setup}
SMTP.Host := SmtpServerName;
SMTP.Port := SmtpServerPort;
{now we send the message}
SMTP.Connect;
try
SMTP.Send(IdMsgSend);
finally
SMTP.Disconnect;
end;
end;