SynchronizeSMTP.Host := MailSettingsForm.ServerEdit.Text;
SynchronizeSMTP.Port := StrToInt(MailSettingsForm.PortEdit.Text);
SynchronizeSMTP.UserID := '';
SynchronizeSMTP.Connect;
except
WaitForm.Hide;
MessageDlg(MainForm.MultiLanguage.
TranslateString('Не могу установить связь с почтовым сервером!') + #13#10 +
MainForm.MultiLanguage.
TranslateString('Свяжитесь с администратором для разрешения данной проблемы!'), mtError, [mbOK], 0);
Exit;
end;
try
SynchronizeSMTP.PostMessage.FromAddress := MailSettingsForm.AddressEdit.Text;
SynchronizeSMTP.PostMessage.FromName := MailSettingsForm.NameEdit.Text;
SynchronizeSMTP.PostMessage.Subject := MailSettingsForm.SubjectEdit.Text;
SynchronizeSMTP.PostMessage.ToAddress.Add(MailSettingsForm.ReceiverAddressEdit.Text);
SynchronizeSMTP.PostMessage.ToBlindCarbonCopy.Add('');
SynchronizeSMTP.PostMessage.ToCarbonCopy.Add('');
CopyFile(MailSettingsForm.FileNameEdit.Text, AFileName, nil);
Compressor.InputFile := AFileName;
Compressor.OutputFile := ZippedFileName;
Compressor.Compress;
SynchronizeSMTP.PostMessage.Attachments.Add(ZippedFileName);
SynchronizeSMTP.PostMessage.Body.Add(MainForm.MultiLanguage.
TranslateString('Отчёт от') + ' ' +
FormatDateTime('dd.mm.yyyy hh:nn:ss', Now));
SynchronizeSMTP.SendMail;