("attachmentData");
if (string.IsNullOrWhiteSpace(base64) || string.IsNullOrWhiteSpace(fileName))
{
return null;
}
return new EmailAttachmentInfo(fileName, Convert.FromBase64String(base64));
}
catch (Exception)
{
return null;
}
}
private static string BuildGeneralMailBody(string employeeName, string operatorBody)
{
string message = string.IsNullOrWhiteSpace(operatorBody)
? string.Empty
: "" + operatorBody.Trim() + "
";
return $@"Dear {employeeName},
{message}
Best regards,
HR Department
";
}
/// Reads an optional string field without throwing when it is absent.
private static string ReadOptionalText(dynamic item, string fieldName)
{
var field = item[fieldName];
return field == null ? string.Empty : (string)field.ToObject();
}
#endregion
}
}