Select the search type
  • Site
  • Web
Search
You are here:  Support/Forums
Support

Bring2mind Forums

Notification Email changed by codebehind
Last Post 07/28/2009 3:45 PM by Peter Donker. 3 Replies.
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
8ware 8ware
New Member
New Member
Posts:3


--
07/10/2009 10:23 AM

 Hi,

When a customer requires some files sent by email, i have to send 2 emails (to customer and to my office).

I do that by calling  DMX.Common.EntryUtils.MailEntries().

It works fine, but with same email text... is it possible to change the body of mail in codebehind?

 

Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
07/10/2009 10:53 PM
Hi,

The email body is taken from the setting in the notification matrix (i.e. what you see on the Notifications admin page), but will be the same for all emails sent through MailEntries. That's locked in the method.

What you can try is the following:

Dim n As New Notification(PortalId, Template, User)
n.EntryIDList.Add(entryId)
Dim mmLogType As LogTypeInfo = LogTypesController.GetLogType(PortalId, DMX.Services.Logging.LogTypes.MailMe)
notif.LogType = mmLogType
notif.SendCustom = True
Return notif.Send()

The Template is a string that is found in the resourcefile of the mmLogType and has the same structure as the other notifications. It is like the key that you find in the notification matrix.

Peter
8ware 8ware
New Member
New Member
Posts:3


--
07/17/2009 2:06 PM
Hi Peter,
i translated your code in C#, see following...

_________________

UserInfo UserDestinatario = new UserInfo();
Notification n = new Notification(PortalId, "NotificaPersonalizzata", UserDestinatario);
n.EntryIDList = listEntryIdPrivate;
LogTypeInfo mmLogType = LogTypesController.GetLogType(PortalId, Bring2mind.DNN.Modules.DMX.Services.Logging.LogTypes.MailMe);
n.LogType = mmLogType;
n.SendCustom = true;
n.Send();
_________________

but the "n.Send()" action causes following exception:

Value cannot be null.
Parameter name: input

following, the stack trace:

" at System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator)\r\n at System.Text.RegularExpressions.Regex.Replace(String input, String pattern, MatchEvaluator evaluator)\r\n at Bring2mind.DNN.Modules.DMX.Services.Notification.Notification.Send(String overrideEmail)\r\n at Bring2mind.DNN.Modules.DMX.Services.Notification.Notification.Send()\r\n at SendMailCyb..ctor(Hashtable bt, Int32 PortalId, String UserNameRichiedente, String EMailRichiedente, String DisplayNameRichiedente) in D:\\VISUAL STUDIO PRJ\\Test.Ombvalves\\DesktopModules\\CV-CategoryMenu\\Components\\SendMailCyb.cs:line 134\r\n at CV.DNN.Modules.CategoryMenu.Email.btSendEmail_Click(Object sender, EventArgs e) in D:\\VISUAL STUDIO PRJ\\Test.Ombvalves\\DesktopModules\\CV-CategoryMenu\\Email.ascx.cs:line 88\r\n at System.Web.UI.WebControls.Button.OnClick(EventArgs e)\r\n at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)\r\n at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)\r\n at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)\r\n at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)\r\n at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)"


what i have to do???
thanks!!!!
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
07/28/2009 3:45 PM
You have to specify the BodyTemplate:

n.BodyTemplate = "Your template"

While you're at it also specify the TitleTemplate.

Peter
You are not authorized to post a reply.