I'm trying to to open the default Mail Client with prepopulated attachment in Asp.net.
If i try this on a local server it's working fine but when deployed to the server it's not working anymore.
This is what i've done so far:
 public void SendEmail()
    {
        try
        {
            int count = GridViewDocuments.Rows.Count;
            Outlook.Application oApp = new Outlook.Application();
            Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
            if (count > 0)
            {
                foreach (GridViewRow gr in GridViewDocuments.Rows)
                {
                    CheckBox chckEmail = (CheckBox)gr.FindControl("chckEmail");
                    Label lblDocumentId = (Label)gr.FindControl("lblDocumentId");
                    if (chckEmail.Checked == true)
                    {
                        string documentId = lblDocumentId.Text;
                        string DocumentTile = "";
                        int DocumentId = 0;
                        if (documentId != "")
                        {
                            DocumentId = Convert.ToInt32(documentId);
                        }
                        DocumentTile = GridViewDocuments.Rows[gr.RowIndex].Cells[1].Text;
                        EmailLogs(DocumentId, DocumentTile);
                        string filepath = GetDocumentByReceivingInquiryIdandReceivingInquiryForm(DocumentId);
                        //OpenFileDialog attachment = new OpenFileDialog();
                        if (filepath.Length > 0)
                        {
                            oMailItem.Attachments.Add(Server.MapPath(filepath),
                                Outlook.OlAttachmentType.olByValue,
                                1);
                        }
                        filepath = "";
                    }
                }
            }
            oMailItem.To = toEmail;
            oMailItem.Subject = Subject;
            InserLog("Sending Email By Sending Inquriy Workspace", SendingInqId.ToString());
        }
        catch (Exception ex)
        {
        }
    }