4

I'm trying to configure CC.NET to send email notifications. I have googled a lot about it and found examples also but by using those examples I'm not able to figure out where the actual problem is occuring.

Below is the block of code I'm using it in config file:

<publishers>
        <statistics />
        <xmllogger logDir="c:\TestCC\buildlogs" />
        <email from="mehul.makwana@mycompany.com" mailhost="smtp.gmail.com" mailport="587" useSSL="TRUE" mailhostUsername="mehul.makwana@mycompany.com" includeDetails="TRUE" >
            <users>
                <user name="Radha" group="buildmaster" address="radha.k@mycompany.com" />
                <user name="Mehul" group="developers" address="mehul.makwana@mycompany.com" />
            </users>
            <groups>
                <group name="developers" notifications="always" />
                <group name="buildmaster" notifications="always" />
            </groups>
        </email>
    </publishers>

The above config is passing in CC.NET config validator. How to configure it from scratch? I also want to show error logs in the Dashboard if the build is failing. I'm using nant script for building files.

user1623521
  • 340
  • 1
  • 16
mehul9595
  • 1,925
  • 7
  • 32
  • 55

1 Answers1

9

You have the documentation for the email puiblisher here : http://confluence.public.thoughtworks.org/display/CCNET/Email+Publisher It is up-to-date and explains a lot.

From what I see in your configuration block, it lacks the mailhostPassword. And since CC.net 1.4 the notifications must be declared as follow :

<group name="developers"> 
  <notifications>
    <notificationType>Always</notificationType>
  </notifications>
</group>

Concerning the content of the dashboard and email, you can edit it by modifying the list of xsl files in dashboard.config and ccservice.exe.config. More information here :

Cruise Control .Net not showing Nant build errors

Hope this helps

EDIT
I think your conf would look like that (with gmail smtp) :

<publishers>
    <statistics />
    <xmllogger />
    <email from="myaccount@gmail.com" mailhost="smtp.gmail.com" mailport="587" useSSL="TRUE" mailhostUsername="myaccount@gmail.com" includeDetails="TRUE" mailhostPassword="YourGmailP@ssword" >
        <users>
            <user name="Radha" group="buildmaster" address="radha.k@mycompany.com" />
            <user name="Mehul" group="developers" address="mehul.makwana@mycompany.com" />
        </users>
        <groups>
            <group name="developers">
              <notifications>
                <notificationType>Always</notificationType>
              </notifications>
            </group>
            <group name="buildmaster">
              <notifications>
                <notificationType>Always</notificationType>
              </notifications>
            </group>
        </groups>
    </email>
</publishers>

if you have a smtp server in your company, let's say MailServerName the first line should be

<email from="mehul.makwana@mycompany.com" mailhost="MailServerName" mailhostUsername="mehul.makwana@mycompany.com" mailhostPassword="YourCompanyMailP@ssword" includeDetails="TRUE" >

>

Community
  • 1
  • 1
Benjamin Baumann
  • 4,035
  • 2
  • 25
  • 35
  • well is it compulsory to give valid email account for sending email notifications? – mehul9595 Oct 06 '10 at 12:34
  • You need a smtp server to send an email. If you want to use Gmail's smtp, then yes you need to specify valid login/password. If you have a smtp server in your private network you may not need it but it depends on your smtp server configuration. – Benjamin Baumann Oct 06 '10 at 12:39
  • ok, i tried as they have given in that example even that is not working. Not sure where the problem is occuring – mehul9595 Oct 06 '10 at 12:48
  • I posted a whole email publisher block, could you try with a valid gmail accound or with your company smtp server? – Benjamin Baumann Oct 06 '10 at 13:04
  • ok, let me see this. am i missing changes in some other files too? as you mentioned in your answer for showing error log i mean to say in server/ccnetservice.exe.config file? – mehul9595 Oct 06 '10 at 13:08
  • You can either set the xml in your email publisher block or in the server/ccnetservice.exe.config file. Personnaly I prefer editing the ccnetservice.exe.config. You need to add the xsl\compile.xsl line in the xsl section as it's said in http://stackoverflow.com/questions/3705502/cruise-control-net-not-showing-nant-build-errors/3709184#3709184 . By the way, which version of ccnet are you running? If you are not editing the ccnet.config file you will also need to manually restart the service. – Benjamin Baumann Oct 06 '10 at 13:14
  • ok that worked for me thanks a lot :) well after restarting the service manually it worked fine :) – mehul9595 Oct 06 '10 at 13:21
  • 1
    I'm glad that helped you. If you edit the ccnet.config file the service automatically restart, but if you edit your conf without editing it (for example editing another file that is included in your ccnet.config) you must restart it to see the changes, it's good to know that. – Benjamin Baumann Oct 06 '10 at 13:28
  • well by looking around some other posts for showing error log on dashboard i made some change in dashboard.config file and after seeing it that it was not working i reverted those changes so, was that a problem of not restarting service automatically? – mehul9595 Oct 06 '10 at 13:34
  • Nope, dashboard.config modifications not showing up is another problem : you need to restart the whole IIS to see them. If you edit your server conf (although not editing the ccnet.config file), you need to restart the "Cruise Control .net" service. – Benjamin Baumann Oct 06 '10 at 13:51