How can we convert from String to System.Net.Mail.MailMessage

Hello @rchin you need to create the custom activity of the given code just need to pass the path of the mail file below is the code and later on you can make this publish to market place which help other

Approach 1

Approach 2

Code for activities

using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Mail;
using MsgReader;
using System.Data;

namespace EmailProcessingLibrary
{
    public class EmailProcessor
    {
        public DataTable ProcessEmails(string folderPath)
        {
            DataTable emailData = new DataTable();
            emailData.Columns.Add("Subject", typeof(string));
            emailData.Columns.Add("From", typeof(string));
            emailData.Columns.Add("ReceivedDate", typeof(DateTime));
            emailData.Columns.Add("AttachmentCount", typeof(int));
            emailData.Columns.Add("Body", typeof(string));

            string[] msgFiles = Directory.GetFiles(folderPath, "*.msg");

            foreach (string msgFile in msgFiles)
            {
                MailMessage mailMessage = ParseMsgFile(msgFile);

                string subject = mailMessage.Subject;
                string from = mailMessage.From.Address;
                DateTime receivedDate = mailMessage.Headers.Date;
                int attachmentCount = mailMessage.Attachments.Count;
                string body = mailMessage.Body;

                emailData.Rows.Add(subject, from, receivedDate, attachmentCount, body);

                mailMessage.Dispose();
            }

            return emailData;
        }

        private MailMessage ParseMsgFile(string msgFilePath)
        {
            using (var msgReader = new Reader(msgFilePath))
            {
                return msgReader.CreateMailMessage();
            }
        }
    }
}

Note: you need to modify the miner code as per UiPath custom activities

@rchin it helps you solve your issue.