Title: SMTP send via STARTTLS
Hello all,

i want to send emails in 2 different Variations
a: STARTTLS Port 587
b: TLS Port Port 465
c: without encryption / no SSL

a and b do not work. I get an errormessage at smtp.Login(): 'SMTP ERROR: Login:???-Other undefined Status'

Are any DLLs required for SSL communication ? If required which ones?
What configuration is required to change between STARTTLS and TLS ?
I used this code as an example:
http://www.synapse.ararat.cz/doku.php/public:howto:smtpsend



procedure TForm1.MailSend(const sSmtpHost, sSmtpPort, sSmtpUser, sSmtpPasswd, sFrom, sTo, sFileName: AnsiString);
var
 smtp: TSMTPSend;
 msg_lines: TStringList;
begin
 msg_lines := TStringList.Create;
 smtp := TSMTPSend.Create;
 try
  // msg_lines.LoadFromFile(sFileName);
   msg_lines.Insert(0, 'From: ' + sFrom);
   msg_lines.Insert(1, 'To: ' + sTo);

   smtp.UserName := sSmtpUser;
   smtp.Password := sSmtpPasswd;

   smtp.TargetHost := sSmtpHost;
   smtp.TargetPort := sSmtpPort;

//    smtp.AutoTLS := False;


   AddToLog('SMTP Login');
   if not smtp.Login() then
     raise ESMTP.Create('SMTP ERROR: Login:' + smtp.EnhCodeString);
   AddToLog('SMTP StartTLS');
   if not smtp.StartTLS() then
     raise ESMTP.Create('SMTP ERROR: StartTLS:' + smtp.EnhCodeString);

   AddToLog('SMTP Mail');
   if not smtp.MailFrom(sFrom, Length(sFrom)) then
     raise ESMTP.Create('SMTP ERROR: MailFrom:' + smtp.EnhCodeString);
   if not smtp.MailTo(sTo) then
     raise ESMTP.Create('SMTP ERROR: MailTo:' + smtp.EnhCodeString);
   if not smtp.MailData(msg_lines) then
     raise ESMTP.Create('SMTP ERROR: MailData:' + smtp.EnhCodeString);

   AddToLog('SMTP Logout');
   if not smtp.Logout() then
     raise ESMTP.Create('SMTP ERROR: Logout:' + smtp.EnhCodeString);
   AddToLog('OK!');
 finally
   msg_lines.Free;
   smtp.Free;
 end;
end;


Regards, Kostas


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to