Developer forum

Forum » Development » Hardcoded SMTP server in API

Hardcoded SMTP server in API


Reply
Hi guys,

I stumbled across a weird error when i was rendering an order via the API.

When i called the method Dynamicweb.eCommerce.Frontend.RenderOrder() i got an error like this "System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25".
My solutions uses a different smtp server, so i didn't understand the error at first.

But I did some digging and it turned out that there is a logging feature in the RenderOrder() method that has the dynamicweb smtp server hardcoded.
I don't care about the logging, but i don't like the hardcoded smtp server.

Does anyone have a suggestion on how i avoid the socket error?

//Martin



Replies

 
Reply
I found a nasty workaround for the bug, where i in the 'hosts' file maps smtp.dynamicsystems.dk to a different ip. but it shouldn't be neccesary.

// Martin
 
Nicolai Høeg Pedersen
Reply

Dynamicweb tries to report a specific situation - a bug. In there the smtp is hardcoded - just changed it.

It looks like you miss a parameter "step" with the right value in the cart form...? 

 
Reply

Hi Nicolai,

I want to render the final order, so I send '6' as the parameter.
But if i can avoid the smtp call by changing the value, and still get my order rendered, i'd do it :-)

my code looks like this:

// Get order template
Dynamicweb.Templatev2.Template tmpl = new Dynamicweb.Templatev2.Template( PdfFileTemplate );

// Render order
Dynamicweb.eCommerce.Frontend.Renderer Renderer = new Dynamicweb.eCommerce.Frontend.Renderer( this._PageView );
Renderer.RenderOrder( order, tmpl, true, 6 );

return tmpl.Output();

// Martin

 

You must be logged in to post in the forum