Jump to content
joceravolo

ICS9 - Help creating procedure to send HTML Emails

Recommended Posts

Hi All, 

I am creating a procedure to send HTML emails with images with ICS components. That would be great if it worked and we could have this procedure as an option so people can get started.
I am having some issues, right now I am having an error 501 that should be about the recipient email, but I am adding a recipient email in the procedure. 
Here's the current procedure.

MessageStatus is a procedure to update a status bar with a message. I am using that to see the messages during the process.

I wish ICS also had a synchronous version of this component.

 

 

ICSSendEmail.pas

Share this post


Link to post

It is much easier and safer to use the TIcsMailQueue component, so email is sent even if the mail server is not immediately available.  

 

Look at the OverbyteIcsMailQuTst sample, or one of the server samples like OverbyteIcsSslMultiWebServ that also use mailqueue to call home when in trouble, 

 

Angus

 

Share this post


Link to post

Hi Angus,

 

Maybe I did not express myself properly.

I want email functionality for the software I am writing. So if the user wants to send an HTML email to some contacts, he can do that straight from the software.
I got the procedure to work for 1 email, but when you select more than 1, it does not send. There are no errors, though.

In case the server is not available, I want to process to fail so the user can rectify the issue.

Am I wrong on my assumptions?

 

Thanks in advance.

Share this post


Link to post

The TIcsMailQueue component is designed for exactly your requirement, you queue an HTML identically to your existing code, call the QueueMail method, and then let the component worry about delivering the email, in the background.  You can queue hundreds of emails. 

 

Before queuing anything, you setup one or more SMTP servers, the background thread will then attempt to send queued emails to each of those servers multiple times over many hours until it is sent successfully, remove it from the queue and delete or archive the email.  The sample has a window you can steal that shows queued emails, when they will be next attempted, and allows them to be deleted if never going to get delivered. 

 

Angus

 

 

  • Like 1

Share this post


Link to post

I would love to understand the sample better. 
I think I can use it to build my function, though.

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
×