Sending email with high priority in BPM

I have an automated email alert and this email should be high priority. I’ve only seen C#'s method using System.Net.Mail with the code

message.Priority = MailPriority.High;

This results in a compilation error where MailPriority is unknown. Anyone know how I can get this to work?

do you have

using System.Net.Mail;

in your usings?

Yea I do. I also tried System.Web.Mail.

I looked at my code and I have it working in a customization.
I have

using System.Net;
using System.Net.Mail;

and

message.Priority = MailPriority.High;

complies without any problem.

What mail object are you using? I’m using

var mailer = new Ice.Mail.SmtpMailer(this.Session);
var message = new Ice.Mail.SmtpMail();

Ah, are you using this in a BPM? I am using it in a form customization and using the SMTPClient class

SmtpClient client = new SmtpClient(“smtp.office365.com”);

I’m not sure if the Ice.Mail.SmtpMailer class implements the SMTP client, let me me take a look

Yep I’m in a BPM

try just using a MailMessage as your mail message

var mailer = new Ice.Mail.SmtpMailer(this.Session);
var msg = new MailMessage();
msg.Priority = MailPriority.High;

That works for me in a BPM

Well, it compiles but won’t let me send without using Ice.Mail.SmptMail, hold on

It doesn’t compile for me. It says I may be missing a namespace or something for MailMessage()

MailMessage lives in System.Net.Mail, so unless you’re referencing it it will fail to compile.
I’m trying to dig into Ice.Mai but I’m having trouble finding it, that’s why this is taking so long

I do not see a method for adding priority to the Ice.Mail.SmtpMailer class. You might be better off using your own mailer

Thanks for the time

1 Like

in the SmtpMail class you can set MessagePriority = System.Net.Mail.MailPriority

 Ice.Mail.SmtpMail m = new Ice.Mail.SmtpMail();
m.Priority = System.Net.Mail.MailPriority.High;
//more stuff

@Aaron_Moreng its in the Epicor.Ice.dll (in case you didn’t find it)

2 Likes

Damn, spent like a hour looking for it too, thanks man

1 Like

Yeah those dlls are a nightmare to figure out. Neat trick if you have a BPM Visual Studio Project Tenplate you can do right click go to definition and get the dll

Sounds cool, is that documented anywhere? Also, I don’t even see that assembly in the client folder, is it hidden somewhere?

Well this is BPM so its server side.

Here is the template
https://scrs.epicor.com/ABLConversionweb/Content/Customization.zip

You’ll need your epicweb credentials.

2 Likes

Hah whoops, it’s been a long day…thanks I’ll check it out!

1 Like