#1 2015-11-27 14:37:55

martin.suer
Member
Registered: 2013-12-15
Posts: 76

TSMTPServer and ISMTPServerConnection usage

Hi,

have had some trouble sending Mail with Indy TIdSmtp component and came across your TSMTPServer and related classes in dddInfraEmailer.pas.
Figured I can use them stand alone this kind:

var
  smtp : TSMTPServer;
  smtpconnection : ISMTPServerConnection;
  rcpt : TRawUTF8DynArray;
begin
  SetLength(rcpt,1);
  rcpt[0] := 'mail@abc.xyz';
  smtp := TSMTPServer.Create(TSMTPServerSocketConnection,'mailserver.local',25,'','');
  try
    smtpconnection := TSMTPServerSocketConnection.Create(smtp);
    smtpconnection.SendEmail(rcpt,'sender@xxx.zzz','Mailsubject','','Bodycontent');
    smtpconnection := nil;
  finally
    smtp.Free;
  end;
end;

A mail is actually sent with that code. My question is: Without setting up a Rest Server with DDD Mail daemon etc, is the code above the way to go for just sending a simple mail ?

Thanks
Martin

Offline

#2 2015-11-27 15:05:08

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: TSMTPServer and ISMTPServerConnection usage

Yes, it sounds just fine.

But is has not yet been fully validated in production...
So any feedback is welcome!

Offline

#3 2017-01-05 10:06:43

Daniel
Member
Registered: 2016-12-08
Posts: 23

Re: TSMTPServer and ISMTPServerConnection usage

Hi,

Is there a way to send attachments ?

Offline

#4 2017-01-05 18:50:44

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: TSMTPServer and ISMTPServerConnection usage

Not directly, AFAIR.

Offline

#5 2017-01-06 09:27:52

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: TSMTPServer and ISMTPServerConnection usage

I've found that synapse works well:
http://synapse.ararat.cz/doku.php/
It supports attachments and SSL connections

Offline

Board footer

Powered by FluxBB