Using Upload to create email attachments

I am currently working on an Email suite for my Radzen Blazor Application. I am using MailKit, which works very well. I am stuck on attachments. I think the Upload Component would work well for this, but I am not sure how to get the files selected into the attachments. Anybody have any idea how to do this, or is there another way to upload multiple attachments?

Really love Radzen, Thanks for the Help!

We are not familiar with MailKit however this thread might be useful in your case:

Thank you for that! I am not yet at receiving emails, still working on send.
Regardless of using mailkit, the email parts are To, From, Subject, Mail Message and Attachments. Can I use Upload to incorporate Attachments to my email message, and if so how are the uploads coded so I can parse them to the attachments part of the email?

We can't answer that question as it isn't a built-in Radzen functionality.

Let me ask the question in a different way.

When using Upload component, I set it to multiple files and manual. When I upload multiple files, I see them displayed. Where does Radzen store those images (memory stream?) and how do I access it to store the images (whether to a database table or some other storage method). In the end, I am trying to access the selected files and attach them to an email, but I can't see how to access the upload data.

It doesn't store those images anywhere. When you click upload it posts them to the location specified via the Url property. You can check the Upload files help article.

Radzen generates an UploadController.cs file in every Blazor application which can be further extended to save files or do whatever is needed.

I apologize for my ignorance on this, but I think I am finally starting to get it. The upload controller is storing all the information in the IFormFile.

I have the following custom method

    private async Task SendEmail()
            // create email message
            var email = new MimeMessage();
            email.Subject = emailsubject;
            email.Body = new TextPart(TextFormat.Html) { Text = emailMessage};
            // send email
            using var smtp = new SmtpClient();
            smtp.Connect(outgoingServer, outgoingPort, SecureSocketOptions.Auto);
            smtp.Authenticate(userName, userPassword);
        catch (Exception ex)
            NotificationService.Notify(NotificationSeverity.Error, "Send Email Error!", ex.Message, 7000);

Thank you Benjamin Fadina!

I really don't want to modify the Upload Controller as I only need to use this in the custom method.

Here is the only example I have been able to find of extracting files from IFormFile

public IActionResult UploadFiles(IList<IFormFile> Files)
   foreach (var file in Files)
                if (file.Length > 0)
                    using (var ms = new MemoryStream())
                        var fileBytes = ms.ToArray();
                        Attachment att = new Attachment(new MemoryStream(fileBytes), file.FileName);
I have tried inserting this in various ways, but can't seem to make it work.

Since I have already created to custom method of SendEmail, I just need to insert the IActionResult after var email = new MimeMessage();  but no matter how I try to do this I get errors.  Can someone help me with this ...or point me to an example that will help?

Thanks for all you guys do!