Microsoft Content Management Server - EMail Notification help

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > November 2004 > EMail Notification help





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author EMail Notification help
choihead

2004-10-20, 2:46 am

Code's below, is there anything wrong about it???
using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
using System.Threading;
using System.Globalization;
using System.Web.Mail;
using Microsoft.ContentManagement.Publishing;
using Microsoft.ContentManagement.Publishing.Events;


namespace SwirePro
{
/// <summary>
/// Summary description for Global.
/// </summary>
public class Global : System.Web.HttpApplication
{
public Global()
{
InitializeComponent();
}

protected void Application_Start(Object sender, EventArgs e)
{

}

protected void Session_Start(Object sender, EventArgs e)
{

}

protected void Application_BeginRequest(Object sender, EventArgs e)
{

}

protected void Application_EndRequest(Object sender, EventArgs e)
{

}

protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{

}

protected void Application_Error(Object sender, EventArgs e)
{

}

protected void Session_End(Object sender, EventArgs e)
{

}

protected void Application_End(Object sender, EventArgs e)
{

}
public void CmsPosting_Submitted( Object source, ChangedEventArgs e )
{
System.Web.Mail.MailMessage mail = new
System.Web.Mail.MailMessage();
mail.From ="MCMS Web Author";
Posting submittedPosting = (Posting)e.Target;
mail.Subject = submittedPosting.Name + " has been submitted for
approval.";
mail.Body = submittedPosting.Name + " has been submitted for approval. ";
//foreach (User approver in submittedPosting.Approvers())
//{
//mail.To = approver.ClientAccountName + "@youknow.net";
mail.To = "choihead@abc.com";
System.Web.Mail.SmtpMail.SmtpServer = "localhost";
System.Web.Mail.SmtpMail.Send(mail);
//}
}


#region Web Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}



Angus Logan [MVP]

2004-10-20, 2:46 am

Hi,

Can you please describe the issue you are experiencing.

Regards
--
________________________________________


Angus Logan (MCAD/MCDBA/MCP/MVP for MCMS)
Product Specialist
Microsoft Application Solutions
Data#3 Limited
E angus_logan@data3.com.au
BLOG www.anguslogan.com
________________________________________

"choihead" <choihead@Hotmail.com> wrote in message
news:efMU4CltEHA.3460@TK2MSFTNGP15.phx.gbl...
> Code's below, is there anything wrong about it???
> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Web;
> using System.Web.SessionState;
> using System.Threading;
> using System.Globalization;
> using System.Web.Mail;
> using Microsoft.ContentManagement.Publishing;
> using Microsoft.ContentManagement.Publishing.Events;
>
>
> namespace SwirePro
> {
> /// <summary>
> /// Summary description for Global.
> /// </summary>
> public class Global : System.Web.HttpApplication
> {
> public Global()
> {
> InitializeComponent();
> }
>
> protected void Application_Start(Object sender, EventArgs e)
> {
>
> }
>
> protected void Session_Start(Object sender, EventArgs e)
> {
>
> }
>
> protected void Application_BeginRequest(Object sender, EventArgs e)
> {
>
> }
>
> protected void Application_EndRequest(Object sender, EventArgs e)
> {
>
> }
>
> protected void Application_AuthenticateRequest(Object sender, EventArgs
> e)
> {
>
> }
>
> protected void Application_Error(Object sender, EventArgs e)
> {
>
> }
>
> protected void Session_End(Object sender, EventArgs e)
> {
>
> }
>
> protected void Application_End(Object sender, EventArgs e)
> {
>
> }
> public void CmsPosting_Submitted( Object source, ChangedEventArgs e )
> {
> System.Web.Mail.MailMessage mail = new
> System.Web.Mail.MailMessage();
> mail.From ="MCMS Web Author";
> Posting submittedPosting = (Posting)e.Target;
> mail.Subject = submittedPosting.Name + " has been submitted for
> approval.";
> mail.Body = submittedPosting.Name + " has been submitted for approval.
> ";
> //foreach (User approver in submittedPosting.Approvers())
> //{
> //mail.To = approver.ClientAccountName + "@youknow.net";
> mail.To = "choihead@abc.com";
> System.Web.Mail.SmtpMail.SmtpServer = "localhost";
> System.Web.Mail.SmtpMail.Send(mail);
> //}
> }
>
>
> #region Web Form Designer generated code
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> }
> #endregion
> }
> }
>
>
>



choihead

2004-10-20, 2:46 am

I am testing the SMTP server on localhost now first,
in this code, I suppose it should send out a email whenever a posting is
save, submit, approve, according to the document I got from microsoft. But
then it seems nothing happened, so I dunno if the mailing code is being run
or it just dun work.....it seems nothing happen.. I mean it acts normal but
I dun get emails....

You got what I mean Angus?

thx for helping!
"Angus Logan [MVP]" <angus_logan@data3.com.au> 秎ン
news:eC1DTRltEHA.2596@TK2MSFTNGP15.phx.gbl い级糶...
> Hi,
>
> Can you please describe the issue you are experiencing.
>
> Regards
> --
> ________________________________________

>
> Angus Logan (MCAD/MCDBA/MCP/MVP for MCMS)
> Product Specialist
> Microsoft Application Solutions
> Data#3 Limited
> E angus_logan@data3.com.au
> BLOG www.anguslogan.com
> ________________________________________

> "choihead" <choihead@Hotmail.com> wrote in message
> news:efMU4CltEHA.3460@TK2MSFTNGP15.phx.gbl...
>
>



Angus Logan [MVP]

2004-10-20, 2:46 am

Hi,

Are you sure the code is even being executed?

Can you step through the code with the debugger to see which values are
being entered into the email.

If the event is being fired this is more of an ASP.NET question so you may
get a richer thread in another newsgroup.

Regards

--
________________________________________


Angus Logan (MCAD/MCDBA/MCP/MVP for MCMS)
Product Specialist
Microsoft Application Solutions
Data#3 Limited
E angus_logan@data3.com.au
BLOG www.anguslogan.com
________________________________________

"choihead" <choihead@Hotmail.com> wrote in message
news:OvNIPWltEHA.2128@TK2MSFTNGP11.phx.gbl...
>I am testing the SMTP server on localhost now first,
> in this code, I suppose it should send out a email whenever a posting is
> save, submit, approve, according to the document I got from microsoft. But
> then it seems nothing happened, so I dunno if the mailing code is being
> run
> or it just dun work.....it seems nothing happen.. I mean it acts normal
> but
> I dun get emails....
>
> You got what I mean Angus?
>
> thx for helping!
> "Angus Logan [MVP]" <angus_logan@data3.com.au> 秎ン
> news:eC1DTRltEHA.2596@TK2MSFTNGP15.phx.gbl い级糶...
>
>



choihead

2004-10-20, 2:46 am

ok, sure!~~~ thx a lot, Let me try
"Angus Logan [MVP]" <angus_logan@data3.com.au> 秎ン
news:uX5FYdltEHA.2876@TK2MSFTNGP14.phx.gbl い级糶...
> Hi,
>
> Are you sure the code is even being executed?
>
> Can you step through the code with the debugger to see which values are
> being entered into the email.
>
> If the event is being fired this is more of an ASP.NET question so you may
> get a richer thread in another newsgroup.
>
> Regards
>
> --
> ________________________________________

>
> Angus Logan (MCAD/MCDBA/MCP/MVP for MCMS)
> Product Specialist
> Microsoft Application Solutions
> Data#3 Limited
> E angus_logan@data3.com.au
> BLOG www.anguslogan.com
> ________________________________________

> "choihead" <choihead@Hotmail.com> wrote in message
> news:OvNIPWltEHA.2128@TK2MSFTNGP11.phx.gbl...
But[vbcol=seagreen]
e )[vbcol=seagreen]
>
>



Stefan [MSFT]

2004-10-20, 7:47 am

Hi Choihead,

the implementation you did will only send a mail on submit as implemented it
in the Submitted event handler.
Not on save, not on approve.

Beside that: the event handler code looks good.
What kind of problem are you experiencing?

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"choihead" <choihead@Hotmail.com> wrote in message
news:OvNIPWltEHA.2128@TK2MSFTNGP11.phx.gbl...
> I am testing the SMTP server on localhost now first,
> in this code, I suppose it should send out a email whenever a posting is
> save, submit, approve, according to the document I got from microsoft. But
> then it seems nothing happened, so I dunno if the mailing code is being

run
> or it just dun work.....it seems nothing happen.. I mean it acts normal

but
> I dun get emails....
>
> You got what I mean Angus?
>
> thx for helping!
> "Angus Logan [MVP]" <angus_logan@data3.com.au> 秎ン
> news:eC1DTRltEHA.2596@TK2MSFTNGP15.phx.gbl い级糶...
EventArgs[vbcol=seagreen]
approval.[vbcol=seagreen]
>
>



choihead

2004-10-22, 8:47 pm

Oh I found out the problem now but it's not because of the CMS, it's because
of the delaying of the SMTP server.
THx Stefan
So on Save, I should use the Created Event handler??
and so I just wanna make sure,
if my flow is
Author --->save--->email to editor--->editor submit--->email to Moderator&
editor--->Moderator approve --->email to Author and editor -->Publish.

Then I should need 3 event handler?
CmsPosting_Created for save?
CmsPosting_Submitted for submit?
and CmsPosting_Approved for approved?
also, CmsPosting_Declined for declined i suppose..

am i getting the idea right??

"Stefan [MSFT]" <stefang@online.microsoft.com> 秎ン
news:O1atJsotEHA.1176@TK2MSFTNGP11.phx.gbl い级糶...
> Hi Choihead,
>
> the implementation you did will only send a mail on submit as implemented

it
> in the Submitted event handler.
> Not on save, not on approve.
>
> Beside that: the event handler code looks good.
> What kind of problem are you experiencing?
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no

rights.
>
> MCMS FAQ:
>

http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
> MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
> MCMS Sample Code:
>

http://www.gotdotnet.com/community/...t+S
erver

> MCMS Whitepapers and other docs:
> http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
> --------------------------------
>
>
> "choihead" <choihead@Hotmail.com> wrote in message
> news:OvNIPWltEHA.2128@TK2MSFTNGP11.phx.gbl...
But[vbcol=seagreen]
> run
> but
> EventArgs
e )[vbcol=seagreen]
> approval.
>
>



choihead

2004-10-22, 8:47 pm

Do I still use " foreach (User approver in savedPosting.Approvers())"
after the author saved the post to identify who should I send email to??
"choihead" <choihead@Hotmail.com> 秎ン
news:eCWvl9JuEHA.4040@tk2msftngp13.phx.gbl い级糶...
> Oh I found out the problem now but it's not because of the CMS, it's

because
> of the delaying of the SMTP server.
> THx Stefan
> So on Save, I should use the Created Event handler??
> and so I just wanna make sure,
> if my flow is
> Author --->save--->email to editor--->editor submit--->email to Moderator&
> editor--->Moderator approve --->email to Author and editor -->Publish.
>
> Then I should need 3 event handler?
> CmsPosting_Created for save?
> CmsPosting_Submitted for submit?
> and CmsPosting_Approved for approved?
> also, CmsPosting_Declined for declined i suppose..
>
> am i getting the idea right??
>
> "Stefan [MSFT]" <stefang@online.microsoft.com> 秎ン
> news:O1atJsotEHA.1176@TK2MSFTNGP11.phx.gbl い级糶...
implemented[vbcol=seagreen]
> it
> rights.
>

http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
>

http://www.gotdotnet.com/community/...t+S
erver

is[vbcol=seagreen]
> But
being[vbcol=seagreen]
normal[vbcol=seagreen]
e)[vbcol=seagreen]
> e )
>
>



Stefan [MSFT]

2004-10-23, 7:46 am

Hi Choihead,

the workflow below is wrong.
The correct workflow is as follows:

Author --->save--->Author submit --->email to editor--->editor
approve--->email to Moderator&
> editor--->Moderator approve --->email to Author and editor -->Publish.


Authors will do the submit and Editors will do approve.

You will need a workflow event for Submitted and Approved.
In both events you need to check the Approvers collection and send mails to
these persons.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"choihead" <choihead@Hotmail.com> wrote in message
news:eCWvl9JuEHA.4040@tk2msftngp13.phx.gbl...
> Oh I found out the problem now but it's not because of the CMS, it's

because
> of the delaying of the SMTP server.
> THx Stefan
> So on Save, I should use the Created Event handler??
> and so I just wanna make sure,
> if my flow is
> Author --->save--->email to editor--->editor submit--->email to Moderator&
> editor--->Moderator approve --->email to Author and editor -->Publish.
>
> Then I should need 3 event handler?
> CmsPosting_Created for save?
> CmsPosting_Submitted for submit?
> and CmsPosting_Approved for approved?
> also, CmsPosting_Declined for declined i suppose..
>
> am i getting the idea right??
>
> "Stefan [MSFT]" <stefang@online.microsoft.com> 秎ン
> news:O1atJsotEHA.1176@TK2MSFTNGP11.phx.gbl い级糶...
implemented[vbcol=seagreen]
> it
> rights.
>

http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
>

http://www.gotdotnet.com/community/...t+S
erver

is[vbcol=seagreen]
> But
being[vbcol=seagreen]
normal[vbcol=seagreen]
e)[vbcol=seagreen]
> e )
>
>



Stefan [MSFT]

2004-10-23, 7:46 am

Hi Choihead,

as indicated: the mail needs to be sent on submit and not on save as the
author does the submit.
And yes: you need to use the foreach loop to get the mail out to all
approvers.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"choihead" <choihead@Hotmail.com> wrote in message
news:#4ujBKKuEHA.1452@TK2MSFTNGP11.phx.gbl...
> Do I still use " foreach (User approver in savedPosting.Approvers())"
> after the author saved the post to identify who should I send email to??
> "choihead" <choihead@Hotmail.com> 秎ン
> news:eCWvl9JuEHA.4040@tk2msftngp13.phx.gbl い级糶...
> because
Moderator&[vbcol=seagreen]
> implemented
>

http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
>

http://www.gotdotnet.com/community/...t+S
erver

posting[vbcol=seagreen]
> is
microsoft.[vbcol=seagreen]
> being
> normal
EventArgs[vbcol=seagreen]
> e)
e)[vbcol=seagreen]
ChangedEventArgs[vbcol=seagreen]
for[vbcol=seagreen]
>
>



yakamoz

2004-11-04, 5:48 pm

Since I am new in CMS , my question would be silly but I want to be sure that
the above code will sent emails only related approvers or editors.

I mean that, when a posting created in Cahnel A, it sends to Channel A
editors, moderators? And It wont sent Channel B or others editors, moderators?


"Stefan [MSFT]" wrote:

> Hi Choihead,
>
> the workflow below is wrong.
> The correct workflow is as follows:
>
> Author --->save--->Author submit --->email to editor--->editor
> approve--->email to Moderator&
>
> Authors will do the submit and Editors will do approve.
>
> You will need a workflow event for Submitted and Approved.
> In both events you need to check the Approvers collection and send mails to
> these persons.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> MCMS FAQ:
> http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
> MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
> MCMS Sample Code:
> http://www.gotdotnet.com/community/...t+S
erver

> MCMS Whitepapers and other docs:
> http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
> --------------------------------
>
>
> "choihead" <choihead@Hotmail.com> wrote in message
> news:eCWvl9JuEHA.4040@tk2msftngp13.phx.gbl...
> because
> implemented
> http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
> http://www.gotdotnet.com/community/...t+S
erver

> is
> being
> normal
> e)
>
>
>

Stefan [MSFT]

2004-11-04, 5:48 pm

Hi Yakamoz,

that is correct.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"yakamoz" <yakamoz@discussions.microsoft.com> wrote in message
news:E2531EDB-16E1-4482-B172-E0360A8E91C5@microsoft.com...
> Since I am new in CMS , my question would be silly but I want to be sure

that
> the above code will sent emails only related approvers or editors.
>
> I mean that, when a posting created in Cahnel A, it sends to Channel A
> editors, moderators? And It wont sent Channel B or others editors,

moderators?[vbcol=seagreen]
>
>
> "Stefan [MSFT]" wrote:
>
to[vbcol=seagreen]
rights.[vbcol=seagreen]
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm[vbcol=seagreen]
http://www.gotdotnet.com/community/...t+S
erver
[vbcol=seagreen]
Moderator&[vbcol=seagreen]
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm[vbcol=seagreen]
http://www.gotdotnet.com/community/...t+S
erver
[vbcol=seagreen]
posting[vbcol=seagreen]
microsoft.[vbcol=seagreen]
EventArgs[vbcol=seagreen]
EventArgs e)[vbcol=seagreen]
ChangedEventArgs[vbcol=seagreen]
for[vbcol=seagreen]


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com