IdMsgSend.From.Text := Trim(edUserId.Text)+'
'+Trim(edFromAdress.Text);
IdMsgSend.ReplyTo.EMailAddresses := Trim(edFromAdress.Text);
IdMsgSend.Subject := edSubject.Text;
IdMsgSend.Recipients.Clear;
if cbESMTP.Checked
then
begin
for i := 0
to meToAddress.Lines.Count-1
do
with IdMsgSend.Recipients.Add
do
begin
Name := CharRem(#10+#13+'
;',meToAddress.Lines[i]);
Address := CharRem(#10+#13+'
;',meToAddress.Lines[i]);
end;
end
else IdMsgSend.Recipients.EMailAddresses := CharRem(#10+#13,meToAddress.lines.Text);
IdMsgSend.CCList.Clear;
if cbESMTP.Checked
then
begin
for i := 0
to edToCarbonCopy.Lines.Count-1
do
with IdMsgSend.CCList.Add
do
begin
Name := '
';
Address := CharRem('
;',edToCarbonCopy.Lines[i]);
end;
end
else IdMsgSend.CCList.EMailAddresses := edToCarbonCopy.lines.Text;
IdMsgSend.BccList.Clear;
if cbESMTP.Checked
then
begin
for i := 0
to meToBlindCarbonCopy.Lines.Count-1
do
with IdMsgSend.BccList.Add
do
begin
Name := '
';
Address := CharRem('
;',meToBlindCarbonCopy.Lines[i]);
end;
end
else IdMsgSend.BccList.EMailAddresses := meToBlindCarbonCopy.lines.Text;
IdMsgSend.MessageParts.Clear;
with TIdText.Create(IdMsgSend.MessageParts,
nil)
do
ContentType := '
multipart/related';
with TIdText.Create(IdMsgSend.MessageParts,
nil)
do
begin
ContentType := '
multipart/alternative';
ParentPart := 0;
end;
with TIdText.Create(IdMsgSend.MessageParts,
nil)
do
begin
Body.Text := edText.Text;
CharSet := '
iso-8859-1';
ContentTransfer := '
quoted-printable';
ContentType := '
text/plain';
ParentPart := 1;
end;
with TIdText.Create(IdMsgSend.MessageParts,
nil)
do
begin
x := TStringList.Create;
JvRichEditToHtml.ConvertToHtmlStrings(edText,x);
Body.Text := x.Text;
x.Free;
CharSet := '
iso-8859-1';
ContentTransfer := '
quoted-printable';
ContentType := '
text/html';
ParentPart := 1;
end;
IdMsgSend.ContentType := '
multipart/related; type="text/html"';
for i := 0
to lbAttachment.Items.Count-1
do
with TIdAttachmentFile.Create(IdMsgSend.MessageParts, CharRem(#10+#13,lbAttachment.Items[i]))
do
begin
//ContentType := 'application/ms-excel';
//ParentPart := 1;
end;
try
SMTP.Send(IdMsgSend);
IdMsgSendSuccess(Sender);