Skip to content
This repository has been archived by the owner on May 27, 2019. It is now read-only.

Need help configuring emails #72

Open
VeldMuijz opened this issue Nov 2, 2015 · 10 comments
Open

Need help configuring emails #72

VeldMuijz opened this issue Nov 2, 2015 · 10 comments

Comments

@VeldMuijz
Copy link

It is unclear to me how I should configure the emails and create the emails that I need.
I've seen the documentation and the 'Guide' but it is very short and I need more help.

What I need to know is how i create my own razor syntax email and how I attach this to a email in the shop. I would like a step by step guide.

This is holding me back from going into production with the webshop and I need this resolved.

So help would be appreciated.

@dutchbreeze
Copy link

The folder macroscripts/uwebshopbackend contains an example (maybe from the demostore, not sure)
It’s important to have the word ‘email’ in the filename. Then it will be listed in the email template combobox. No need to register the file, just select it in the emailconfig part.

[dutchbreeze logo]

dutchbreeze b.v.

Adres

:

Demmersweg 92

7556 BN Hengelo

Telefoon

:

053 - 8200 830

Internet

:

www.dutchbreeze.nlhttp://www.dutchbreeze.nl

From: Jeroen [mailto:[email protected]]
Sent: maandag 2 november 2015 14:24
To: uWebshop/uWebshop-Releases [email protected]
Subject: [uWebshop-Releases] Need help configuring emails (#72)

It is unclear to me how I should configure the emails and create the emails that I need.
I've seen the documentation and the 'Guide'http://docs.uwebshop.com/general/guides/member-email-parameters/ but it is very short and I need more help.

What I need to know is how i create my own razor syntax email and how I attach this to a email in the shop. I would like a step by step guide.

This is holding me back from going into production with the webshop and I need this resolved.

So help would be appreciated.


Reply to this email directly or view it on GitHubhttps://github.com//issues/72.

@VeldMuijz
Copy link
Author

Hmm i thought that issue xxx was fixed but today I have the same problem again. I'm getting null back from StoreAPI.GetEmailTemplates.

        public IEnumerable<string> GetEmailTemplates()
        {
            var files = Directory.GetFiles(IOHelper.MapPath(SystemDirectories.Xslt), "*.xslt", SearchOption.AllDirectories).Select(file => file.Replace(IOHelper.MapPath(SystemDirectories.Xslt) + @"\", string.Empty)).ToList();

            files.AddRange(Directory.GetFiles(IOHelper.MapPath(SystemDirectories.MacroScripts), "*.cshtml", SearchOption.AllDirectories).Select(file => file.Replace(IOHelper.MapPath(SystemDirectories.MacroScripts) + @"\", string.Empty)));

            if (IO.Container.Resolve<ICMSApplication>().IsBackendUserAuthenticated)
            {
                return files.Where(x => x.ToLowerInvariant().Contains("email") || x.ToLowerInvariant().Contains("mail"));
            }

            return null;
        }

This piece of code returns null. So either it cannot find any files with the word email or mail or it says that i;m not authorized.

The MacroScripts folder has the uWebshopBackend subfolder folder in it.

├───MacroScripts
│   └───uWebshopBackend

It also has .cshtml files in the uWebshopBackend folder with these files:

    Directory: D:\(....)\MacroScripts\uWebshopBackend
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        14-Oct-15   9:41 AM           3688 uWebshopUmbracoEmailDetails.cshtml
-a----        14-Oct-15   9:41 AM           4823 uWebshopUmbracoOrderDetails.cshtml
-a----        14-Oct-15   9:41 AM           3020 uWebshopUmbracoOrderOverview.cshtml
-a----        14-Oct-15   9:41 AM           1389 uWebshopUmbracoProductOverview.cshtml

I've tried throwing away my cookies, clearing the cache, clean and rebuild of project, adding a TestEmailmail.cshtml to the MacroScripts backend. This all keeps returning null. I am logged in an have all the permissions (administrator).

I had these default .cshtml and .xls templates in the dropdown just before the weekend, now after I started running the application just like before from Visual Studio 2013 it fails to load these files.

How can I debug this?

@dutchbreeze
Copy link

If you see null in backend email combo possibly lecagy control mapping is the failure. Check your log first if this is actually the code that returns null.

[dutchbreeze logo]

dutchbreeze b.v.

Adres

:

M.H. Tromplaan 23x-apple-data-detectors://0

7513 AB Enschedex-apple-data-detectors://0

Telefoon

:

053 - 8200 830tel:053%20-%208200%20830

Fax

:

053 - 8200 864tel:053%20-%208200%20864

Internet

:

www.dutchbreeze.nlhttp://www.dutchbreeze.nl/

Op 2 nov. 2015 om 20:48 heeft Jeroen <[email protected]mailto:[email protected]> het volgende geschreven:

Hmm i thought that issue xxx was fixed but today I have the same problem again. I'm getting null back from StoreAPI.GetEmailTemplates.

    public IEnumerable<string> GetEmailTemplates()
    {
        var files = Directory.GetFiles(IOHelper.MapPath(SystemDirectories.Xslt), "*.xslt", SearchOption.AllDirectories).Select(file => file.Replace(IOHelper.MapPath(SystemDirectories.Xslt) + @"\", string.Empty)).ToList();

        files.AddRange(Directory.GetFiles(IOHelper.MapPath(SystemDirectories.MacroScripts), "*.cshtml", SearchOption.AllDirectories).Select(file => file.Replace(IOHelper.MapPath(SystemDirectories.MacroScripts) + @"\", string.Empty)));

        if (IO.Container.Resolve<ICMSApplication>().IsBackendUserAuthenticated)
        {
            return files.Where(x => x.ToLowerInvariant().Contains("email") || x.ToLowerInvariant().Contains("mail"));
        }

        return null;
    }

This piece of code returns null. So either it cannot find any files with the word email or mail or it says that i;m not authorized.

The MacroScripts folder has the uWebshopBackend subfolder folder in it.

????MacroScripts
? ????uWebshopBackend

It also has .cshtml files in the uWebshopBackend folder with these files:

Directory: D:\(....)\MacroScripts\uWebshopBackend

Mode LastWriteTime Length Name


-a---- 14-Oct-15 9:41 AM 3688 uWebshopUmbracoEmailDetails.cshtml
-a---- 14-Oct-15 9:41 AM 4823 uWebshopUmbracoOrderDetails.cshtml
-a---- 14-Oct-15 9:41 AM 3020 uWebshopUmbracoOrderOverview.cshtml
-a---- 14-Oct-15 9:41 AM 1389 uWebshopUmbracoProductOverview.cshtml

I've tried throwing away my cookies, clearing the cache, clean and rebuild of project, adding a TestEmailmail.cshtml to the MacroScripts backend. This all keeps returning null. I am logged in an have all the permissions (administrator).

I had these default .cshtml and .xls templates in the dropdown just before the weekend, now after I started running the application just like before from Visual Studio 2013 it fails to load these files.

How can I debug this?

Reply to this email directly or view it on GitHubhttps://github.com//issues/72#issuecomment-153137583.

@VeldMuijz
Copy link
Author

Thank you for you answer.
I've checked the log (umbracoTraceLog) and the only warning that i could find is:

2015-11-02 20:53:36,246 [P16028/D2/T1] WARN  Umbraco.Core.Sync.DatabaseServerMessenger - No last synced Id found, this generally means this is a new server/install. The server will rebuild its caches and indexes and then adjust it's last synced id to the latest found in the database and will start maintaining cache updates based on that id

And I have one entry of this:

2015-11-02 20:42:26,438 [P13820/D2/T9] ERROR Umbraco.Web.WebApi.Filters.AngularAntiForgeryHelper - Could not validate XSRF token
System.Web.Mvc.HttpAntiForgeryException (0x80004005): The anti-forgery token could not be decrypted. If this application is hosted by a Web Farm or cluster, ensure that all machines are running the same version of ASP.NET Web Pages and that the <machineKey> configuration specifies explicit encryption and validation keys. AutoGenerate cannot be used in a cluster.
   at System.Web.Helpers.AntiXsrf.AntiForgeryTokenSerializer.Deserialize(String serializedToken)
   at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.DeserializeToken(String serializedToken)
   at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.Validate(HttpContextBase httpContext, String cookieToken, String formToken)
   at System.Web.Helpers.AntiForgery.Validate(String cookieToken, String formToken)
   at Umbraco.Web.WebApi.Filters.AngularAntiForgeryHelper.ValidateTokens(String cookieToken, String headerToken)

I don't see other errors about 'lecagy control mapping' or an exception from the getEmailTemplate action..

@dutchbreeze
Copy link

Ok, forget the legacy issue. Just my best wild guess.
It seems that it's not a really fresh install or that it's crossdomain header authentication fails. Are you running a balanced or multiple domain setup? Are the calls and api's within the same domain (no misconfigured balanced environment)? If not, make sure you did a clean install, not just overwrite some of the files.

[dutchbreeze logo]

dutchbreeze b.v.

Adres

:

M.H. Tromplaan 23x-apple-data-detectors://0

7513 AB Enschedex-apple-data-detectors://0

Telefoon

:

053 - 8200 830tel:053%20-%208200%20830

Fax

:

053 - 8200 864tel:053%20-%208200%20864

Internet

:

www.dutchbreeze.nlhttp://www.dutchbreeze.nl/

Op 2 nov. 2015 om 21:09 heeft Jeroen <[email protected]mailto:[email protected]> het volgende geschreven:

Thank you for you answer.
I've checked the log (umbracoTraceLog) and the only warning that i could find is:

2015-11-02 20:53:36,246 [P16028/D2/T1] WARN Umbraco.Core.Sync.DatabaseServerMessenger - No last synced Id found, this generally means this is a new server/install. The server will rebuild its caches and indexes and then adjust it's last synced id to the latest found in the database and will start maintaining cache updates based on that id

And I have one entry of this:

2015-11-02 20:42:26,438 [P13820/D2/T9] ERROR Umbraco.Web.WebApi.Filters.AngularAntiForgeryHelper - Could not validate XSRF token
System.Web.Mvc.HttpAntiForgeryException (0x80004005): The anti-forgery token could not be decrypted. If this application is hosted by a Web Farm or cluster, ensure that all machines are running the same version of ASP.NEThttp://asp.net Web Pages and that the configuration specifies explicit encryption and validation keys. AutoGenerate cannot be used in a cluster.
at System.Web.Helpers.AntiXsrf.AntiForgeryTokenSerializer.Deserialize(String serializedToken)
at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.DeserializeToken(String serializedToken)
at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.Validate(HttpContextBase httpContext, String cookieToken, String formToken)
at System.Web.Helpers.AntiForgery.Validate(String cookieToken, String formToken)
at Umbraco.Web.WebApi.Filters.AngularAntiForgeryHelper.ValidateTokens(String cookieToken, String headerToken)

I don't see other errors about 'lecagy control mapping' or an exception from the getEmailTemplate action..

Reply to this email directly or view it on GitHubhttps://github.com//issues/72#issuecomment-153142696.

@VeldMuijz
Copy link
Author

I did not reinstall anything since i've used it for the last time.
Your suggestion is to do a clean install? I've had this issue before when I deployed a clean install to Azure and the same symptoms where popping up.
I've set up a lot of stuff on the store already and it'd be a waste to do it all over and have the same issue again..

Also i'm not running in a farm and the xsrf token was only once reported in the log, i've requested the email templates multiple times before and after that log entry.

@dutchbreeze
Copy link

So it does work locally? Did you check that all dll's are present serverside and same versioned? Maybe due to updates that didnt get deployed?

[dutchbreeze logo]

dutchbreeze b.v.

Adres

:

M.H. Tromplaan 23x-apple-data-detectors://0

7513 AB Enschedex-apple-data-detectors://0

Telefoon

:

053 - 8200 830tel:053%20-%208200%20830

Fax

:

053 - 8200 864tel:053%20-%208200%20864

Internet

:

www.dutchbreeze.nlhttp://www.dutchbreeze.nl/

Op 2 nov. 2015 om 21:31 heeft Jeroen <[email protected]mailto:[email protected]> het volgende geschreven:

I did not reinstall anything since i've used it for the last time.
Your suggestion is to do a clean install? I've had this issue before when I deployed a clean install to Azure and the same symptoms where popping up.
I've set up a lot of stuff on the store already and it'd be a waste to do it all over and have the same issue again..

Reply to this email directly or view it on GitHubhttps://github.com//issues/72#issuecomment-153147885.

@VeldMuijz
Copy link
Author

I'm sorry for the confusion.
Im running locally in visual studio 2013 debugging. Ive seen this problem before when i deployed an umbraco installation from the azure app gallery.

Last friday it worked in my dev environment but i saw some templates disappearing last friday it was weird to me at the time but I stopped looking into it due to lack of time. Today it started to show null in the dropdown menu..

@VeldMuijz
Copy link
Author

I think something is wrong with the database. I'm also not able to store my user information when I try to update my profile:
I get this exception:

 2015-11-03 16:46:53,809 [P10676/D2/T8] ERROR Umbraco.Core.Security.AuthenticationExtensions - The current identity cannot be converted to Umbraco.Core.Security.UmbracoBackOfficeIdentity
System.InvalidOperationException: Cannot create a Umbraco.Core.Security.UmbracoBackOfficeIdentity from System.Security.Claims.ClaimsIdentity since the required claim http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier is missing
   at Umbraco.Core.Security.UmbracoBackOfficeIdentity.FromClaimsIdentity(ClaimsIdentity identity)

I'm going to try and reinstall, are there tips for using localdb in the correct way with umbraco?

@VeldMuijz
Copy link
Author

Ok... after I reinstalled Umbraco in an empty visual studio web project (by installing via install-package umbracocms it installs 7.3.1. Then downloading the installer package from uWebshop the email templates return null (but the MacroScripts\uwebshopBackend\ has .cshtml files in it with the word email in it.

When i look at the log i still see the

2015-11-05 20:06:18,335 [P11128/D2/T9] ERROR Umbraco.Core.Security.AuthenticationExtensions - The current identity cannot be converted to Umbraco.Core.Security.UmbracoBackOfficeIdentity
System.InvalidOperationException: Cannot create a Umbraco.Core.Security.UmbracoBackOfficeIdentity from System.Security.Claims.ClaimsIdentity since the required claim http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier is missing
   at Umbraco.Core.Security.UmbracoBackOfficeIdentity.FromClaimsIdentity(ClaimsIdentity identity)
   at Umbraco.Core.Security.AuthenticationExtensions.GetCurrentIdentity(HttpContextBase http, Boolean authenticateRequestIfNotFound)
 2015-11-05 20:07:27,974 [P11128/D2/T42] INFO  Umbraco.Core.Security.BackOfficeSignInManager - Event Id: 0, state: Login attempt succeeded for username [email protected] from IP address ::1

So something is still going wrong with the claim.
I googled this message and got to this umbraco issues page. Here they speak of breaking changes in the way membership/identity is handled since v7.3.0.

I've installed umbraco 7.2.6 in a new project and installed the uWebshop and it works. I get email templates now, even the ones that I create myself.

Now the functions of the emails make sense to me again. @dutchbreeze thanks for your help with debugging. I'm not sure if the error should be fixed at uWebshop of at Umbraco.. Care to weigh in?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants