Handle Hyperlink Click Event in Outlook Mail in C# - c#

I want to handle the hyperlink click event in an outlook mail. To open the hyperlinks in outlook mails without opening the browser within itself.
Does anyone know how to handle hyperlink click event on a mail item?

After searching a lot, I found that there is no way to catch the hyperlink click event in outlook.
If we want to catch a link we can define our own protocol url as follow.
http://msdn.microsoft.com/en-us/library/aa767914(VS.85).aspx
Then using our own protocol handler we can catch the event.
If someone needs more information ask here.

Write an Outlook Add-in .net to handle that. To get the basic idea about writing an add- in look at the following link.
http://blogs.msdn.com/b/dancre/archive/2004/03/21/93712.aspx

Related

Trigger ItemSend when item is being sent from outbox using addon

I'm writing an outlook addon that triggers when the Send button is sent on an email, if certain conditions are met a pop up comes up asking if the user is sure they want to send the email.
This works perfectly. However, A lot of emails that get sent are passed into outlook through another program and go into the drafts folder and are slowly sent out. Is there an Event handler for when an email is sent that doesn't rely on the send button being clicked?
EDIT:
I've found that the Send() method can be called to send an email - would it be possible to check if this method is called and when it is to run my code?
If the external app is using the Outlook Object Model to send the messages, Application.ItemSend event will still fire. Otherwise the best you can of is use Items.ItemAdd event on the Sent Items folder - it will trigger after a message is actually sent and moved to the Sent Items folder.

Click "Send" button of G-Mail programmatically

I am creating an Email Sending Software. So far i am able to open chrome and fill the details of the email (subject,body,attachments and all) but i wanted to know is there any way i can click Send button of G-Mail programmatically too?
Code for filling details in chrome
Process ps = Process.Start("chrome.exe", "https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&to=a#gmail.com&bcc=b#gmail.com);
Note I haven't used SmtpClient to send email because it was not fulfilling my customized requirement (sorry cannot disclose the reason).
The way you want this, is not possible. Process.Start opens a new Process. In this case it opens Google Chrome, with the URL you sent with it. This URL contains a querystring containing the subject and the body of the email. This is possible, because Google reads this on the server-side, and puts it in the right fields. There is no way to enter the send button though. This is a POST action, which can not be triggered by a URL.
C# form, does have a WebBrowser class. From here you can access buttons and click them, but I don't think Google will allow this, and most likely send you a captcha. (That is, if you manage to login in the first place.)
I can't help with the simulated button press you're looking for, but I can suggest that you rather try to use the Gmail API to do what you're trying to do:
https://developers.google.com/gmail/api/?hl=en
This would be a more reliable and stable way to send gmail programmatically, and you still don't have to use the smtp object directly.
You should probably use Selenium (WebDriver). It allows you to control browser from c# code, navigates pages, traversing DOM etc..

Handling attachment events in an outlook add-in

Is anyone aware of a technique I could use to override someone opening an email attachment within an outlook add-in?
Essentially what I'm being asked to do, is for certain attachments, to change the behavior so instead of opening the attachment the user is redirected to a webpage.
I can hook into the attachment context menu with Application.AttachmentContextMenuDisplay however that is not fired if the user simply double clicks on an email attachment.
Environment used is VS2010, c#, and outlook 2007/2010.
You should take a look at the ItemEvent BeforeAttachmentRead and BeforeAttachmentPreview. See this related post for reference.
((Outlook.ItemEvents_10_Event)MailItem).BeforeAttachmentRead += new Outlook.ItemEvents_10_BeforeAttachmentReadEventHandler(ItemEvents_BeforeAttachmentRead);
((Outlook.ItemEvents_10_Event)MailItem).BeforeAttachmentPreview += new Outlook.ItemEvents_10_BeforeAttachmentPreviewEventHandler(ItemEvents_BeforeAttachmentPreview);

How do I use the mailTo protocol on in C# for a sharepoint web part?

I've been trying to use the mail to protocol in my C# code - but its not working for me as everytime I press the button that is supposed to run the mailto code - the page refreshes instead and the outlook new message window does not open
My code is the following
System.Diagnostics.Process.Start("mailto:"+email);
"email" above is a string object that is retrieved from a sharepoint list.
Given your "mailto:"+email code fragment I am assuming that what you really want is this:
You want the user on your website to press a button which opens a new Outlook message with your E-Mail address, correct?
No need to use server side C# for this, as this is regular HTML and the default e-mail client is handling the mailto: protocol (just like your browser handles the http: protocol).
All you need to do is to have something like this:
Mail me on your site and once the user clicks this link the default mail program (might not be outlook) will handle the mailto link. You could also do this via a button.

Detect when user returns from using EmailComposeTask?

I noticed the user is redirected back to our app after sending an email using the EmailComposeTask. Is there maybe a Completed event handler for this or someway to determine when the user returns back to our app?
The NavigatedTo event will be raised when the control comes back to your page.
Thanks,
Stefan Wick - Microsoft Silverlight
Yes there is a completed event handler.
Here is how to do it for CameraCaptureTask. EmailComposeTask should be the same.

Categories

Resources