#1 2015-10-14 10:57:26

From: France
Registered: 2015-09-14
Posts: 58

SynCrtSock SendEmail error

Hi !

On server side,when a particular table is updated, it call a function who send an email using your SendEmail() from SynCrtSock.
Nothing particular here:

function SendMail;
  subject, header, text, mailDest: String;
  header := '-Intervention-';
  subject := 'Some Subject';
  text := 'some text' + sLineBreak;
  text := text + 'more text' + sLineBreak;
  mailDest := 'mail@mail.com';

  if SendEmail('serverAdress.fr',           //Server
              'contact@mail.fr',               //From
              SockString(mailDest),         //CSVDest
              SendEmailSubject(subject), //Subject
              SockString(text),              //Text
              SockString(header),          //headers
              'user',                             //User
              'password')                      //Pass
              = true then
      log.Add.Log(sllInfo, 'SUCCESS')
      log.Add.Log(sllInfo, 'FAILURE');

When i'm running the server localy in console mode there is no problem, i'm receiving the email and in the log i can see 'SUCCESS', but if i'm running the application as a Windows service in the log i have "20151014 10320136 EXC   EInOutError ("Erreur E/S -10060")", and no 'FAILURE'.
From what i can understand, its an input output error, but caused by what? I've also found this https://support.microsoft.com/en-us/kb/191143

Is this coming from my server setting ?

thanks for your help.

EDIT: In the same service, I have another procedure who send mail with attachment using another unit using the same email server, and there is no problem

EDIT2: before posting, i was using for the subject of the mail SockString(subject), but because i thought my error could come from this i have put SendEmailSubject(subject). If i send an email with this (in local) the subject of the received mail is "=?UTF-8?B?W0ludGVydmVudGlvbl0gVmFsaWRhdGlvbiBkJ3VuIHRvZG8gcXVlIHZvdXMgYXZleiBhdHRyaWJ1w6k=". If I use SockString() instead i receive the right subject.

Last edited by StxLog (2015-10-14 11:45:17)


#2 2015-10-14 11:52:18

From: France
Registered: 2010-06-21
Posts: 14,037

Re: SynCrtSock SendEmail error

I just made a test, and SendEmail() did work here.

Are you sure your server does not expect TLS secure connection?

SendEmail() does not support TLS, and is by default running on port 25.

If the issue changes because of the user making the process, I guess this may be a Windows firewall issue.


#3 2015-10-14 13:47:44

From: France
Registered: 2015-09-14
Posts: 58

Re: SynCrtSock SendEmail error

Thanks you for your very fast response (just like your framework) as usual, i'm going to check this within a day and come back to give update.


#4 2015-10-15 08:48:27

From: France
Registered: 2015-09-14
Posts: 58

Re: SynCrtSock SendEmail error

He does not expect TLS and we have tried opening port 25, neither of these solution worked...

In the meantime I have noticed that my procedure wasn't well implemented and was kind of blocking the whole server while it was trying to send email, so i've reimplemented it in the client app, and now everything is going as expected ; )
For now I'm going to let it like that, its not a critical feature, but I still dont understand what happened here.

Thanks again for your time!


#5 2015-10-15 09:11:42

From: Germany
Registered: 2014-08-06
Posts: 330

Re: SynCrtSock SendEmail error

My experience, if it work in debug mode with console and in release mode within a service not, then it is a problem of the file path and the read or write access rights.
What's the path of the service (HKLM\SYSTEM\CurrentControlSet\Services\YourServiceName\ImagePath)? Could this path have permissions?


Board footer

Powered by FluxBB