And the code for sending the e-mail look like this: I am aware that my customerId is hardcoded, I don't know if that makes a difference.
var emailService = UCommerce.Infrastructure.ObjectFactory.Instance.Resolve();
var localizationContext = UCommerce.Infrastructure.ObjectFactory.Instance.Resolve();
// Find the relevant e-mail profile for the current store
var emailProfile = UCommerce.Runtime.SiteContext.Current.CatalogContext.CurrentCatalogGroup.EmailProfile;
// Load information for e-mail personalization
var purchaseOrder = UCommerce.Runtime.SiteContext.Current.OrderContext.GetBasket().PurchaseOrder;
// Set up personalization parameters - params will be passed to
// the configured e-mail template
var queryStringParameters = new Dictionary();
queryStringParameters.Add("orderGuid", purchaseOrder.OrderGuid.ToString());
//queryStringParameters.Add("customerId", purchaseOrder.Customer.CustomerId.ToString());
queryStringParameters.Add("customerId", "0");
// Send e-mail
emailService.Send(localizationContext,
emailProfile,
"OrderConfirmation",
new System.Net.Mail.MailAddress(purchaseOrder.BillingAddress.EmailAddress),
queryStringParameters);
The strange thing is that is is different on the server than when I run it locally.
Problem sending mails with UCommerce
First ill say that I know that this topic has been brough up severel times before. Unfortunately they didn't solve my problem though.
I'm trying to send a simple order confirmation e-mail.
This goes well locally but not when I upload the code to my site.
My smtp-settings look like this:
<smtp> <network port="587" host="asmtp.unoeuro.com" userName="kontakt@*****.dk" password="****" /></smtp>
And the code for sending the e-mail look like this:
I am aware that my customerId is hardcoded, I don't know if that makes a difference.
var emailService = UCommerce.Infrastructure.ObjectFactory.Instance.Resolve(); var localizationContext = UCommerce.Infrastructure.ObjectFactory.Instance.Resolve(); // Find the relevant e-mail profile for the current store var emailProfile = UCommerce.Runtime.SiteContext.Current.CatalogContext.CurrentCatalogGroup.EmailProfile; // Load information for e-mail personalization var purchaseOrder = UCommerce.Runtime.SiteContext.Current.OrderContext.GetBasket().PurchaseOrder; // Set up personalization parameters - params will be passed to // the configured e-mail template var queryStringParameters = new Dictionary(); queryStringParameters.Add("orderGuid", purchaseOrder.OrderGuid.ToString()); //queryStringParameters.Add("customerId", purchaseOrder.Customer.CustomerId.ToString()); queryStringParameters.Add("customerId", "0"); // Send e-mail
emailService.Send(localizationContext, emailProfile, "OrderConfirmation", new System.Net.Mail.MailAddress(purchaseOrder.BillingAddress.EmailAddress), queryStringParameters);
The strange thing is that is is different on the server than when I run it locally.
I forgot to say that the error happens when it is trying to run Confirmation.cshtml, and that local and server share the same Database.
Error loading Razor Script uCommerce/Confirmation.cshtml
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.