an ASP.NET Open Source CMS & eCommerce platform
Search:
Last Post 6/4/2009 1:38:47 PM By Bahram. 10 replies.
6/2/2009 9:33:57 AM
bansal_db
Posts: 181
Joined: 4/13/2009
New email template
Hey Luke,
 
I need to create a new email template. How do i add it to the site?
 
Thanks.
6/2/2009 10:03:45 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: New email template
Insert your email template to table DSC_Template and then you can call method EmailManager.Send to send email. Here is the code snippet for sending new user email.
 
            NameValueCollection tokens = CoreHelper.GetSiteTokens();
            tokens.Add("UserName", CreateUserWizard1.UserName);
            tokens.Add("ActivationID", User.GetActivationId(userId));
            EmailManager.Send("AccountActivation", tokens, tokens["Store.SiteEmailAddress"], new string[] { CreateUserWizard1.Email });
DotShoppingCart Staff
6/2/2009 11:04:06 AM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: New email template
-
6/4/2009 7:51:07 AM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: New email template
Luke,
 
I am adding the email confirmation on the UserEdit page because I want to send out the email after the account is approved.
 
Which object stores the customer Information??
 
I got these
 
tokens.Add("UserName",DSCUser.UserName);
tokens.Add("UserEmail", DSCUser.Email);
 
 
which object stores the address information for the customer?
 
Thanks
6/4/2009 8:18:31 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: New email template
Yes, you can use User class.
DotShoppingCart Staff
6/4/2009 9:05:05 AM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: New email template
Here is what the email section looks like
 
 
newCustomerSource salesRepID = new newCustomerSource();
 
User salesRep = DSC.User.GetUser(salesRepID.getSalesRepIDInt(DSCUser.UserName));
 
        NameValueCollection tokens = CoreHelper.GetSiteTokens();
        tokens.Add("UserName",DSCUser.UserName);
        tokens.Add("UserEmail", DSCUser.Email);
        tokens.Add("UserFirstName", DSCUser.Address.FirstName);
        tokens.Add("UserLastName", DSCUser.Address.LastName);
        tokens.Add("UserAddress1", DSCUser.Address.Address1);
        tokens.Add("UserAddress2", DSCUser.Address.Address2);
        tokens.Add("UserCity", DSCUser.Address.City);
        tokens.Add("UserState", DSCUser.Address.State);
        tokens.Add("UserZip", DSCUser.Address.Zipcode);
        tokens.Add("UserPhone", DSCUser.Address.Phone);
 
 
        tokens.Add("SalesRepFirstName", salesRep.Address.FirstName);
        tokens.Add("SalesRepLastName", salesRep.Address.LastName);
        tokens.Add("SalesRepEmail", salesRep.Email);
       
EmailManager.Send("AccountApproval", tokens, tokens["Store.SiteEmailAddress"], new string[] { DSCUser.Email });
 
 
Now how do i use these tokens in the template?
 
%User.UserName%, %User.SalesRepEmail%???
 
 
 
 
6/4/2009 9:11:42 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: New email template
Wrap the token with %, e.g. %UserName%, %SalesRepEmail%.
DotShoppingCart Staff
6/4/2009 11:55:04 AM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: New email template
Where is the reference to new template in DSC_Template, would you please write down all scenario and codes in one place.
 
Bahram
6/4/2009 12:03:03 PM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: New email template

 

"AccountApproval" is the new template

 

6/4/2009 1:36:55 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: New email template
-
6/4/2009 1:38:47 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: New email template
Thanks,
User does not have this method
 
GetActivationId(userId
 
It has GetUser and GetUserID