Sending PageMailDefinition emails from disjointed code

In order to send a PageMailDefinition email from disjointed code (modified order state transition actions) it appears to require some lookup info for the email acquisition.
IoC.Resolve< RouteRequestLookupInfoAccessor >().RouteRequestLookupInfo = new RouteRequestLookupInfo(…)

So far i’ve figured out that you need a Channel, DomainName and a DomainNameLink. Assuming I have a Channel, how are the other values best attained? Is it actually a good approach to assign these values manually?

Litium version: 7.1

The route request won’t be set if the code is from integration.

You could get the channel id from the order object and use that with the mail service. Would your mail work differently from the order confirmation mail? (besides content)

Here’s some related information:

1 Like

It would work the same way as the order confirmation page mail, and I already have the channel from the order object, the main issue is the DomainName and DomainNameLink, which I would assume should always point to localhost.

You can get DomainNameLinks from the channel and then use the domain name service to look up the domain name.

But if you look at the steps from the other thread, you don’t need to set the route request to send the mail.

1 Like

I made the other thread, and for whatever reason, I cannot send the email without manually setting the RouteRequestLookupInfo, my main issue is that I do not know how I can get the correct DomainNameLink and Domain from the Channel. I can get a domain, but I do not know of a way I can dynamically get the correct one for any channel.

I made the other thread …

That’s my mistake, I apologize.

On the channel there’s a DomainNameLinks property with all the connected domains to the channel. The first one in the list is the main domain, while any others are possible alternative domains. So if you look up that one using the domain name service, wouldn’t you get the information you need?

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.