I am trying to send mail from user's Outlook send folder with the following code.But it shows the following error: My code
try
{
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNamespace = new Outlook.NameSpace("MAPI");
Outlook.MailItem oMailItem = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMailItem.HTMLBody = bd.Trim();
oMailItem.Subject = sbj.Trim();
Outlook.Recipients oRecips = (Outlook.Recipients)oMailItem.Recipients;
Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add(bccadd);
oRecip.Resolve();
oMailItem.Send();
oRecip = null;
oRecips = null;
oMailItem = null;
oApp = null;
}
catch (Exception ex)
{
Response.Write("<script>alert('" + ex.Message + "');</script>");
//string script = "<script>alert('" + ex.Message + "');</script>";
}
But I am getting the following error:
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))