Tuesday, October 13, 2009

Groupwise Email through C# .net

Recently i got a task to send email from Novell groupware client, after little googling i found some vb.net code, i converted vb.net code to C#.


Check API documentation

http://developer.novell.com/wiki/images/6/61/GWDevGuide.pdf


In order to send an email through groupwise/novel groupware client from ASP.net application developed in C#.

1) Add the "GroupwareTypeLibrary" com reference from Add reference in a asp.net project.

using GroupwareTypeLibrary;

2) Paste the following C# code change the groupware login id and password. You are good to go.

try
{

GroupwareTypeLibrary.Application gwapplication = new Application();
GroupwareTypeLibrary.Account objAccount = gwapplication.Login("jsarfraz", null, "pwd", GroupwareTypeLibrary.LoginConstants.egwNeverPrompt, null);
Messages messages = objAccount.MailBox.Messages;
Message message = messages.Add("GW.MESSAGE.MAIL", "Draft", null);
Recipients recipients = message.Recipients;
Recipient recipient = recipients.Add("test@dhs.lacounty.gov", null, null);
message.Subject.PlainText = "Testing Message Subject";
message.BodyText.PlainText = "Testing Message Body";

Message myMessage = message.Send();


}

catch (Exception ex)
{
}

2 comments:

  1. Hi

    Works great, but I'm having problems sending attachments, any ideas?

    James

    ReplyDelete
  2. Hi,

    Under Message message = messages.Ad("GW.MESSAGE.MAIL", "Draft", null);

    put
    message.Attachments.Add(@"C:\picture1.jpg");
    for example.
    It should be works.

    ReplyDelete