Reputation: 279
Step 1: I have a requirement like On clicking a button in my Application, Mail should be triggered to respective person in To list.
Step 2: That Mail item should contain one link like "Click here to approve".
Step 3: On clicking that link, Another Mail item should open with To: [email protected], CC:[email protected], subject etc...
I am done with Step 1 and Step 2. But how to do Step 3.
Note : It is an C# application.
I am using below C# code
Body = "Hi, "
Body += "%0D The Deal - " + ClientName + ", has been Assigned to you %0D%0D"
Body += "Expected Signature Date : " + SignDate + " %0D"
Body += "Expected Funding Date : " + FundingDate + " %0D%0D"
Body += "Please, click the below link to view the details. %0D%0D"
Body += PathName + "%0D"
Body += "<a href=mailto: [email protected]?Subject=Subject&body=Body> Click here to send mail</a>"
Body = Body.Replace("&", " ")
Body = Body.Replace("#", "")
sMsg = User.Redirect("mailto:" + cc + "?Subject=" + Subject + "&body=" + Body)
Redirect Function:
Public Function Redirect(ByVal PageName As String) As String
Dim sb As New StringBuilder()
sb.Append("window.location.href='" + PageName + "'; ")
Return sb.ToString()
End Function
If i use the Outlook dll How to open the Mail item.
Eg: Mailitem.Send() will send the mail. But i need to open the mail item.
Upvotes: 0
Views: 1145
Reputation: 3571
Outlook.Application app = new Outlook.Application ();
Outlook._MailItem mailItm = ( Outlook._MailItem)app.CreateItem ( Outlook.OlItemType.olMailItem );
mailItm.To = "[email protected]";
mailItm.Cc = "[email protected]";
mailItm.Subject = "Some Subject";
// body, bcc etc...
mailItm.Display ( true );
If you are clicking on a link to send email with filling (To, Subject, Cc, etc.,) without using asp.net, you can do something like following using mailto:
<a href="mailto:[email protected]?Subject=Some%20Subject&[email protected]>
Click here to send mail
</a>
Upvotes: 1