Jump to content
Helge Larsen

How to save send SMTP mail to .eml file

Recommended Posts

Hello

Have just converted an older legacy system from using Indy TIdSMTP to ICS TSslSmtpCli component, after Microsoft changed the security requirement to minimum TLS1.2.

The old system was mostly sequentialy, so we had to do some rewriting to use the async model, but that is now handled fine.

We can now send emails using smtp.office365.com with no problems.

 

In our old system we used to save the send email to a .eml file, that could be opens in outlook.

This was done in the Indy MailMessage component with the SaveToFile method.

 

How can we do the same in the ICS TSslSmtpCli component?

 

Share this post


Link to post

You should be using the TIcsMailQueue component, there is a working mass mailer example in OverbyteIcsMailQuTst.dpr. 

 

You prepare mail using TSslSmtpCli, the queue component saves it as an EML file and places it into a queue from which a thread tries to send it repeatedly to multiple SMTP servers, and when sent successfully the EML file is either deleted or archived.   At least I hope it's the correct EML format, I've never tested with other applications. 

 

Angus

 

Share this post


Link to post
15 hours ago, Helge Larsen said:

Have just converted an older legacy system from using Indy TIdSMTP to ICS TSslSmtpCli component, after Microsoft changed the security requirement to minimum TLS1.2.

Indy (more specifically, its OpenSSL IOHandler) supports TLS 1.2 just fine, so you should not have needed to switch to another SMTP library just to continue communicating with Microsoft.

Share this post


Link to post

May be Indy supports TLS 1.2 but it still cant connect to Microsoft Office365 SMTP server.

May be its something in the other parts of OpenSSL 1.0.2u that does not work.

 

ICS supports OpenSSL 3.0.1 that can connect to Microsoft Office365 SMTP server.

 

Share this post


Link to post

I can connect fine using Indy and TLS 1.2 so please show your code.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×