How to add a new message template?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hi,

is it possible to add a new message template? If so, can you provide sample code to send an email?

Thanks in advance!
11 years ago
Hi,

You can add a new message template using SQL-query to your database.

For example,

IF NOT EXISTS (
   SELECT 1
   FROM [dbo].[MessageTemplate]
   WHERE [Name]=N'YourMessageTemplate')
BEGIN
INSERT [dbo].[MessageTemplate] ([Name], [BccEmailAddresses], [Subject], [Body], [IsActive], [EmailAccountId])
VALUES (N'YourMessageTemplate', NULL, N'%Store.Name%. Hello!', N'<p> Hi! This message from% Store.Name% </ p> ', 'true', 1)
END
GO

For 2.80.

Then you can edit it in the admin area.
11 years ago
Mariann wrote:
Hi,

You can add a new message template using SQL-query to your database.

For example,

IF NOT EXISTS (
   SELECT 1
   FROM [dbo].[MessageTemplate]
   WHERE [Name]=N'YourMessageTemplate')
BEGIN
INSERT [dbo].[MessageTemplate] ([Name], [BccEmailAddresses], [Subject], [Body], [IsActive], [EmailAccountId])
VALUES (N'YourMessageTemplate', NULL, N'%Store.Name%. Hello!', N'<p> Hi! This message from% Store.Name% </ p> ', 'true', 1)
END
GO

For 2.80.

Then you can edit it in the admin area.


thanks.

and how can i call this new template ?
probably only from source code, right ?

Shay
11 years ago
Yes. If you want to use this message template to send, you need to edit the code.
11 years ago
Can someone please provide sample code?
11 years ago
What code do you mean?
11 years ago
Source code showing how to send an e-mail which is using a message template.
Thanks
11 years ago
To all: when suggesting or referring to a page or template item or otherwise to edit/modify, please, please, please be specific.
Which page name, located where?  With MVC there are often 2-4 places where code needs to be modified. And in nopC there are several cs pages that could be confused as which ones.  So, kindly, be specific.
11 years ago
@e-novative: If you would have read the post, you would see that nobody is suggesting or referring to a page or template item.
I was just asking for a simple code example, which shows how to send an email using a message template. Anyway, guess it's easier to look for that code by myself.
10 years ago
[email protected] wrote:
Source code showing how to send an e-mail which is using a message template.
Thanks


Agreed, som sample code about this would help alot with some explanation.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.