Sending Custom Email Notifications

Last post 12-21-2007 11:09 AM by AudiRS6. 0 replies.

Sort Posts:

  • Sending Custom Email Notifications

    12-21-2007, 11:09 AM
    • Loading...
    • AudiRS6
    • Joined on 08-21-2007, 7:42 PM
    • Posts 4

     

      Hi,

    I am modifying the email notification that is send when some one responds to a post. What I am trying to do is include the response in the email along with all the original information that comes standard. But it seems like I am missing something. Here is the email notification that I get.

    Dear admin,

    A new item was added to the Discussion section. <NewPost> .

    You can view this item by clicking the following link: http://CommunityStarterKit.com/CommunityStarterKit/Discuss/Discussion/0.aspx

     ----------------------------- If you would like to disable these notifications, you can edit your profile at http://CommunityStarterKit.com/CommunityStarterKit/Users_EditProfile.aspx

    "

    What I am trying to do is replace the <NewPost> with the text of the reply. I have modified the stored procedure Community_NotifySendNotifications to retrive the response.


    CREATE PROCEDURE Community_NotifySendNotifications
    (
      @communityID int,
      @sectionID int,
      @contentPageID int
    )
    AS
    DECLARE @parentID int
    SELECT
     @parentID = ContentPage_ParentID
    FROM
     Community_ContentPages
    WHERE
     ContentPage_ID = @contentPageID


    SELECT 
     User_Username,
     User_Email,
     User_FirstName,
     User_LastName,
     Comment_Text
     
    FROM
     Community_Notifications WITH (nolock)
     JOIN Community_Users WITH (nolock)
      ON Notify_userID = User_ID, community_comments
    WHERE
     User_EnableNotifications = 1
     AND Notify_CommunityID = @communityID
     AND Notify_sectionID = @sectionID
     AND ( Notify_contentPageID = @contentPageID OR Notify_ContentPageID = @parentID OR Notify_contentPageID = -1)
     and comment_contentPageID = ( select max(Comment_ContentPageID) from community_comments)

    I have added a the code below to NotifyFormatInfo.cs:

    string _newContent = String.Empty;
           
    //*********************************************************************
            //
            // Response Property
            //
            // Represents the discussion response replaced in the email.
            //
            //*********************************************************************

           
            public string newContent {
                get {return _newContent;}
                set {_newContent = value;}
            }

    I have added the following code in NotifyUtility.cs:

    inside public static void SendNotifications

     formatInfo.newContent = (string)dr["content_text"];

     

    inside public static string FormatEmail

     text = text.Replace("<NewPost>", formatInfo.newContent);

     Am I missing something else or doing something incorrectly, since the <NewPost> token doesnt seem to get replaced.

    Thanks in advance for any help or alternative solutions.

Page 1 of 1 (1 items)
Microsoft Communities
Page view counter