views:

41

answers:

1

Hi All,

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 that examples also im not able to figure out where the actual problem is occuring. Below is the block of code im using it in config file,

<publishers>
        <statistics />
        <xmllogger logDir="c:\TestCC\buildlogs" />
        <email from="[email protected]" mailhost="smtp.gmail.com" mailport="587" useSSL="TRUE" mailhostUsername="[email protected]" includeDetails="TRUE" >
            <users>
                <user name="Radha" group="buildmaster" address="[email protected]" />
                <user name="Mehul" group="developers" address="[email protected]" />
            </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. Can any one please help on this or suggest me 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

Mehul Makwana

+2  A: 

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 : http://stackoverflow.com/questions/3705502/cruise-control-net-not-showing-nant-build-errors/3709184#3709184

Hope this helps

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

<publishers>
    <statistics />
    <xmllogger />
    <email from="[email protected]" mailhost="smtp.gmail.com" mailport="587" useSSL="TRUE" mailhostUsername="[email protected]" includeDetails="TRUE" mailhostPassword="YourGmailP@ssword" >
        <users>
            <user name="Radha" group="buildmaster" address="[email protected]" />
            <user name="Mehul" group="developers" address="[email protected]" />
        </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="[email protected]" mailhost="MailServerName" mailhostUsername="[email protected]" mailhostPassword="YourCompanyMailP@ssword" includeDetails="TRUE" >

>

Benjamin Baumann
well is it compulsory to give valid email account for sending email notifications?
mehul9595
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
ok, i tried as they have given in that example even that is not working. Not sure where the problem is occuring
mehul9595
I posted a whole email publisher block, could you try with a valid gmail accound or with your company smtp server?
Benjamin Baumann
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
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
ok that worked for me thanks a lot :) well after restarting the service manually it worked fine :)
mehul9595
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
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
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
thanks a lot for your support Benjamin :) it works!!!
mehul9595