Hi,
i am using the following code to open outlook Express to send mail ,but i get
" System.Unauthor izedAccessExcep tion: Access is denied. at WebApplication7 .WebForm9.Butto n1_Click(Object sender, EventArgs e) in c:\inetpub\wwwr oot\webapplicat ion7\outlookfrm .aspx.cs:line 57 " this error.
My code:
Outlook._Applic ation app = null;
Outlook._NameSp ace nameSpace = null;
Outlook.MailIte m memo = null;
Outlook.MAPIFol der outbox = null;
try
{
app = new Outlook.Applica tionClass();
nameSpace = app.GetNamespac e("MAPI");
nameSpace.Logon (null,null,fals e, false);
outbox = nameSpace.GetDe faultFolder(Out look.OlDefaultF olders.olFolder Drafts);
memo = (Outlook.MailIt em)app.CreateIt em(Outlook.OlIt emType.olMailIt em);
memo.To = "wf.tl@recordsa nddata.com";
memo.Subject = "TechRepublic.c om Test";
memo.Body = "Hello there";
memo.SaveSentMe ssageFolder = outbox;
memo.Send();
}
catch(System.Ex ception ex)
{
Response.Write( ex.ToString());
}
Any Body Please give me any suggesion or any other option for opening outlook.
i am using the following code to open outlook Express to send mail ,but i get
" System.Unauthor izedAccessExcep tion: Access is denied. at WebApplication7 .WebForm9.Butto n1_Click(Object sender, EventArgs e) in c:\inetpub\wwwr oot\webapplicat ion7\outlookfrm .aspx.cs:line 57 " this error.
My code:
Outlook._Applic ation app = null;
Outlook._NameSp ace nameSpace = null;
Outlook.MailIte m memo = null;
Outlook.MAPIFol der outbox = null;
try
{
app = new Outlook.Applica tionClass();
nameSpace = app.GetNamespac e("MAPI");
nameSpace.Logon (null,null,fals e, false);
outbox = nameSpace.GetDe faultFolder(Out look.OlDefaultF olders.olFolder Drafts);
memo = (Outlook.MailIt em)app.CreateIt em(Outlook.OlIt emType.olMailIt em);
memo.To = "wf.tl@recordsa nddata.com";
memo.Subject = "TechRepublic.c om Test";
memo.Body = "Hello there";
memo.SaveSentMe ssageFolder = outbox;
memo.Send();
}
catch(System.Ex ception ex)
{
Response.Write( ex.ToString());
}
Any Body Please give me any suggesion or any other option for opening outlook.
Comment