sana khan
asked on
On Button click outlook will open and the link generated will be copied to outlook
When a user clicks the button an outlook will open and the link generated will be copied to outlook email message..Can you help me for this in asp.net
Below is the file related to this issue is attached with it.LinkGeneration.txt
Below is the file related to this issue is attached with it.LinkGeneration.txt
Javascript popups are sometimes disabled on different machines/browsers which will prevent the javascript code from executing. You can try this server side in C# as well.
using System.Diagnostics;
protected void btnRedirect_Click(object sender, EventArgs e)
{
var myUrl = "mailto:someone@somewhere.com?subject=Test&body=" + txtLink.Text;
Process.Start(myUrl);
Response.Redirect(URL + "?" + getQueryString());
}
Hi sana,
First add reference of ‘Microsoft.Office.Interop. Outlook’ library in your project. This code will run on any machines that contains Outlook locally.
Then add below lines of code to your .cs page.
For more details please follow the link.
http://www.authorcode.com/how-to-create-outlook-email-item-using-c-and-vb-net/
First add reference of ‘Microsoft.Office.Interop.
Then add below lines of code to your .cs page.
protected void btnRedirect_Click(object sender, EventArgs e)
{
//Response.Redirect(URL + "?" + getQueryString());
string Messagebody = URL + "?" + getQueryString();
CreateMailItem(Messagebody);
}
private void CreateMailItem(string Messagebody)
{
Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem mailItem = (Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mailItem.Subject = "This is the test message";
mailItem.To = "contactus@authorcode.com";
mailItem.CC = "supporttools@authorcode.com";
mailItem.Body = Messagebody;
mailItem.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceNormal;
mailItem.Display(false);
mailItem = null;
oApp = null;
}
For more details please follow the link.
http://www.authorcode.com/how-to-create-outlook-email-item-using-c-and-vb-net/
ASKER
Actually i am working on server so how would i add reference of ‘Microsoft.Office.Interop. Outlook’ library in my project, because it is not showing
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
then try add this into your HTML:
Open in new window