Send Email as different user (Change Email From Field) Intercept SSRS Report Call

Hey guys, I’m banging my head against the wall as I haven’t found a way to do what I want.
I thought it would be pretty simple, but now I’m not sure it is even possible.

We have epicor set up to send mail from the server from a “noreply” address. It works fine and sends fine.
I’d like to be able to override the from field when sending an ssrs report. (I would give noreply send on behalf of permission.)

I can do this in a BPM call with the mailer if I do this myself, but I can’t seem to find any intercept where I can change this field when done from a report. I’ve been through method directives all morning looking and debugging. I’m at a loss.

Anyway, Is this even possible? Any insights would be appreciated.

Thanks,
Kevin

Well, the easy answer here would be use Advanced Print Routing… if you own it.

Otherwise, you could try and hook into the report’s SubmitToAgent method and inject the email there. Downside is each report has its own.

Correct me if I’m wrong, but doesn’t APR still use the mail configuration set in the company settings? I think you can spoof the “from” email in APR but the actual server is the same

I guess I’ve never really verified it, but you can set a “From” email address. I just assumed it would show up in the email box from that address?

Correct. I’m probably overthinking the question now that I see what they are asking lol

  1. If you leave From Blank it will pull from Company Settings
  2. If you fill out the from with something@yourdomain.com it will use that (spoof via smtp)
  3. If you want to get the Users Email (APR isnt build for that), you will have to modify your RDD (Report Data Definition and join on the table UserFile based on lets say InvcHead.SalesRepEmail_c or something like ChangedBy

So instead of messing with RDDs because you can very quickly destroy your ARForm RDD by adding a bunch of metadata joins. What most people do is they add fields to the Company Table such as:

  • Company.SalesEmailAddr_c
  • Company.AREmailAddr_c
  • Company.APEmailAddr_c

image

Because Company is a table that is ALREADY in 99.9% of RDDs, they simply include it and viola, no joins. But then the email comes atleast from lets say accounting@yourdomain.com.

In more simpler terms there is no way to get like Session or CurrentUserEmailAddr easily in Routing.

I was told the Advanced APR (DocStar) version has more control, but not the basic edition.

6 Likes

We don’t have Advanced Print Routing, and the datasets from SubmitToAgent don’t include a field for “from”.

I’d really recommend looking into it, it’s a great little add on that makes stuff like this trivial.

It turns out we do have APR, and I was able to do what I wanted to do.

I would still like to know if there is any other way to intercept all emails before they go out without apr.
If anyone knows, I’m like Dumbo…

1 Like

Not using SMTP, but if you’re an O365 user, you can use the Microsoft Graph to send email, create drafts, etc.

Outlook mail API overview - Microsoft Graph | Microsoft Learn

Thanks.

I just find it odd that with as much stuff as they expose in epicor, I can’t believe that they didn’t expose it as a business object that can be used/traced/and modified. Just a black hole.

I haven’t found many black holes in Epicor. They expose just about everything!

I think it’s more the nature of SMTP, which has been roundly abused over the years, including people changing the From: address for phishing and spamming. O365 does expose this because it’s using a client agent that confirms who you are or if you have the security to send on-behalf of another user. SMTP just doesn’t check.

The other reason to use something like the MS Graph is that it handles failures better. With SMTP, if the first server hit is not successful, your message is gone. Where does that error go? Into that black hole… And you may or may not know, I’m not a big fan of any application given access to SMTP. It’s “what we used to do” but we need to find more secure and resilient ways to notify people and stop using email directly - IMHO.

2 Likes

I’m pretty much with you on most of that. If they exposed it at the programming level though, we could intercept and add our own stuff there while not having to touch so many places if you want to add functionality.