Send SMTP email activity is not stable

Im using version 2.5.10 of UiPath.Mail.Activities with studio version 2023.10.14

  • when i have put the body content in HTML form and post converting into text only half the text getting converted
  • when you click the body while in text form after few letters type it get out from typing automatically

Problems with activities please work on it.

Hi @omkardes

UiPath.Mail.Activities 2.5.10 is quite old and not fully compatible with Studio 2023.10.x. That’s why the HTML → Text conversion behaves oddly and the body field loses focus while typing.

The fix is to update UiPath.Mail.Activities to a newer version from Manage Packages (preferably the latest stable). After upgrading, re-add the activity if needed and test again.

If upgrading is not possible, a workaround is to manually convert HTML to text using custom logic (for example, stripping tags) instead of relying on the activity’s conversion.

Hi @omkardes

Pls try to update the latest package.
Or you can provide what exactly expecting..

Thanks

Hi @omkardes

Please update the Package and Share the Screenshot with the error or helps us what was the issue comes in details

Thanks

Hi @omkardes

I have been in the same situation. You can try upgrading or finding the stable version for the activity but you should switch to Invoke code - C# code to send out smtp emails.

Please refer to the code block below

try
{
using (System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage())
{
mail.From = new System.Net.Mail.MailAddress(fromEmail);
mail.To.Add(toEmail);

    mail.Subject = subject ?? string.Empty;
    mail.Body = bodyHtml ?? string.Empty;
    mail.IsBodyHtml = true;

    // Attachments (optional)
    if (attachmentPaths != null)
    {
        foreach (string path in attachmentPaths)
        {
            if (!string.IsNullOrWhiteSpace(path) && System.IO.File.Exists(path))
            {
                mail.Attachments.Add(new System.Net.Mail.Attachment(path));
            }
        }
    }

    using (System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(smtpHost, smtpPort))
    {
        smtp.EnableSsl = enableSsl;

        // If your SMTP requires auth (most do)
        smtp.Credentials = new System.Net.NetworkCredential(smtpUser, smtpPass);

        // Recommended: do NOT use default credentials when supplying NetworkCredential
        smtp.UseDefaultCredentials = false;

        // Optional: increase timeout (ms)
        smtp.Timeout = 100000;

        smtp.Send(mail);
    }
}

}
catch (System.Exception ex)
{
// This will fail the workflow with a readable message
throw new System.Exception("SMTP email send failed: " + ex.Message, ex);
}

Pls let me know if this works out for you. If it does pls mark it as solution.

Thanks,
Kunal

i would suggest you to place your html body in a text file and read it in your solution.
if there are any dynamic parts that you need to add, use content place holders and manipulate it in solution.

P.S : SMTP is almost stopped by most orgs, since its uses unsecure port 25, you might wanna setup a new way to use GRAPH API for emails.

SG.