What I am trying to achieve is this:
I am sending an email to someone within my organization asking them to attend a meeting (this will all be on the same domain, i.e. #gmail.com), From here, I want them to be able to click a button or label, which will send an email to a specific person (so basically a confirmation email that they accept the meeting). I am sending the 1st email in C# by using the following code:
string theBody = "Do You Accept: " + "Click Here/Button"
Message objMessage = new Message();
objMessage.NameFrom = Convert.ToString(ConfigurationManager.AppSettings["SMTPSendingName"]);
objMessage.EmailFrom = Convert.ToString(ConfigurationManager.AppSettings["SMTPSendingEmailAddress"]);
objMessage.NameTo = "Subject";
objMessage.EmailTo = "To#email.com";
objMessage.EmailMessage =
string.Format(theBody);
Where I have written "Click Here/Button" is where I would like the clickable text or button, that sends an email back to a hard coded email address, something like the following:
string returnEmail = "mailto:return#mail.com?subject=Accepted?body=" + theBody;
To Clarify:
An email is sent to person a from C# using the above code block 1
When person a receives the email, I want them to be able to click a button or clickable text, that in turn sends an email to a person b
This clickable button or text must be embeded in C#
My Organisation are using Outlook 2016
This is they way I though would be best, however I am open to any better suggestions into how I can achieve something like this. Thankyou in advance for your help.
Below is an example image of what I have, as you can see its just a long hyperlink, which does work for now. This opens up a new outlook message, and the user has to press send. I would prefer this to happen all in one click but if this is not possible, then that is ok.
You could have an endpoint in your api, that will be hit when the user clicks on accept. On that endpoint, you could use Office365 APIs (https://msdn.microsoft.com/en-us/library/office/dn776319(v=exchg.150).aspx), more specifically, the Calendar API, to accept the meeting.
You can't. HTML in Outlook is rendered by Word, and it will not run any scripts. The best you can is provide a link that will be opened in the user's browser, which can then do something meaningful.
have you considered a custom outlook form?
https://msdn.microsoft.com/en-us/library/office/ff868929.aspx
If you're not on an exchange backend, you might have to send the form template around to your users. Exchange allows for "Organizational Forms" which all users can get.
The custom form allows you to add buttons and code-behind in the custom form for very much what you are asking.
Related
I am working with Outlook addin which is perform task for creating new mail item and sent to users.
Now what I want is, I don't want to allow user to add email in To field, in short I need To field to remain disable for user, but I am not getting any way to disable it.
MailApp.Application oApp = new MailApp.Application();
oMailItem =(MailApp.MailItem)oApp.CreateItem(MailApp.OlItemType.olMailItem);
oMailItem.To = "abc#gg.com"; // need to disable this for end user.
oMailItem.Subject = "Xyz";
oMailItem.HTMLBody = "Xyz";
oMailItem.Display(false);
oMailItem.Actions[1].Enabled = false; // it allow index from 1 to 4 which disable reply , reply all, reply to and forward option on current mail but not To field.
Please help to achieve this in my addin. How can I disable To field for end user?
The only way to disable the To field address control is to customize the form design, remove the controls and publish that form definition to that user's Personal Forms library. For more information, see https://learn.microsoft.com/en-ca/office/vba/outlook/concepts/forms/customizing-form-pages-and-form-regions.
In addition to Eric's suggestion, you can try to hook the MailIem.PropertyChange event, and when (and if!) the "To" property is modified, reset it back.
There is no need to customize the built-in Outlook form and then re-publish it. It is a very old technology which is not used any longer by add-in developers.
You can use Outlook form regions and place the form to the Replace-all layout which replaces the whole Outlook form with the form region. Read more about that in the Create Outlook form regions article on MSDN.
Also, you may consider using Add-in Express. They provide the CompleteReplacement layout which also completely replace all pages of any Inspector window.
Note, in both cases, you can use any .net controls for creating a custom UI in Outlook
I am successfully sending an outlook mail from my c# application with the following html content.
MYForm:
form
{Role}, {Firstname} {lastname} with User ID {userID} has requested for the TurboComp access.
<p>Yes,Grant the Access</p>
<p>No,Acess Denied</p>
/form
Now, when the recipient receives the mail with this html content, and click on "yes" or "no" link, I want an outlook email to be sent back to the user who has initially sent the mail.
Thanks, In advance
I found the solution to trigger the email back from outlook when the user clicks on link.
I made following change to my form:
MyForm:
form
{Role}, {Firstname} {lastname} with User ID {userID} has requested for the TurboComp access.
<p>Yes,Grant the Access</p>
<p>No,Access Denied</p>
</form>
ThankYou:)
this is my way to how to do if I were you.
You can generate the unique route for catching clicks in action.
Example : [Route("Foo/{memberId=0}/{canAccess}")]
Then you generate that URL yes and no buttons in your HTML content because the recipient will click it. You care of that URL. It has to contain memberId and button access state(yes or no) so when the recipient clicks the URL you can use your business below the route attribute like an example.
[Route("Foo/{memberId=0}/{canAccess}")]
public ActionResult Foo(string memberId, bool canAccess)
{
// Code..
}
Hope this could help to you.
I need my bot to print a different message than its caption (which shows by telegram client on keyboard button element).
My custom button has this text: "Where am I?" and when I click on it, it prints on the screen "Where am I?" also.
I want the button to print "/location".(something different from its text field)
How can I achieve it? I'm using C# and Telegram Bot API
EDIT:
What I want:
When the user clicks this button, telegram client send a messages with /age [as his typed message] but NOT send show my age (which is that button text field )
So: I want a button with a text . when the user clicks the button I want the message sent to be different from that text.
Have you looked at InlineKeyboardMarkup instead of ReplyKeyboardMarkup? It solves your problem.
UPD
Basic usage
public static InlineKeyboardMarkup TestInlineKeyboard { get; } = new InlineKeyboardMarkup
{
InlineKeyboard = new []{new[] {new InlineKeyboardButton("Text1","Data1"), new InlineKeyboardButton("text1","data2")} }
};
where "Text1" and "text1" are captions of the inline buttons, "Data1" and "data2" is CallbackQuery text, which your bot will receive when user clicks inline button.
Note, that bot sends not any message to user when he clicks inline button. If you need to send any message at that moment - you can do that programmatically.
There is a boolean field for location, did you set it to true?
https://core.telegram.org/bots/api#keyboardbutton
Update:
hen you are sending a reply to the user, you are also sending a ReplyKeyboardMarkup.
ReplyKeyboardMarkup has a field called keyboard which is Array of Array of KeyboardButton.
on each KeyboardButton you have a bool for location that you need to set to true if you want that button to send the location
Update 2
it is not possible to have a message different than your text. text- String->Text of the button. If none of the optional fields are used, it will be sent to the bot as a message when the button is pressed
I am creating an email using the c# MailMessage and I am trying to add a checkbox that doesn't need to be clicked. The checkboxes will be used for a checklist of what to bring to an event (like a packing list). I have:
MailMessage objEmail = new MailMessage();
objEmail.From = new MailAddress("sender#hotmail.com");
objEmail.To.Add(new MailAddress("example1#hotmail.com"));
objEmail.CC.Add(new MailAddress("example2#hotmail.com"));
objEmail.Bcc.Add(new MailAddress("example3#hotmail.com"));
objEmail.Subject = "Packing list!";
objEmail.IsBodyHtml = true;
objEmail.Body = #"<div width=""800px"">
<h3>WHAT TO BRING</h3>
<form>
<input type=""checkbox"" name=""item"" value=""shirt"">Shirt<br>
<input type=""checkbox"" name=""item"" value=""shoes"">Shoes
</form></div>";
but when I send the email the checkboxes do not appear in the list.
Output in outlook using outlook.com:
WHAT TO BRING
I have a bike
I have a car
Output in outlook using Microsoft Outlook:
WHAT TO BRING
[ ]I have a bike
[ ]I have a car
Output in outlook using hotmail.com:
WHAT TO BRING
I have a bike
[]I have a car
So the problem is with the mail client but it is inconsistent what the problem is. I s there any way to make a consistent output?
Is there a way with html that works to create the checkboxes or do I just need to include images of a checkbox?
Thanks in advance.
My guess is that their in inconsistency with the way the email clients handle check boxes.
Why not change each to [X] which is plain text so all email clients can see it.
Outlook.com has an issue to display multiple check or radio buttons within a single parent. / / / etc
add a table in there and add the 2 check boxes in a separate row and it should work fine.
weird Microsoft thinking
All email clients have their own rules on what's allowed. You may find that most providers don't allow JavaScript and just some allow positioning elements while some don't.
Your best bet is to use a plain text form or maybe an image of what the form looks like. And when I say image, don't mean make the entire thing an image, have images for each checkbox. Once you click anywhere in this form it opens up on your site to interact with it.
Furthermore, you really shouldn't be building html in your code like you are. Put that in an MVC view or a webforms partial and invoke the file from code. Using this approach you can still inject dynamic data into the template while putting the HTML where it belongs.
I want my website to be shown on a 'kiosked' computer (i.e. the site is the only thing visible on the screen). And I have a card reader that sends a string to whatever text field is active when a card is shown to it. After the string the card reader sends a tab-key.
Now how could I receive the string each time the card is shown and at the same time keep the website active at all times. When the tab-key is sent it should not tab to the address bar or anywhere else, if it would then I wouldn't receive the next string as the site wouldn't be active any longer.
Also, the received string should never be visible on the the screen, I just want to receive it in the code behind.
How might I solve this?
You could handle the change event of the textbox and post the data via AJAX to your controller then re-focus the field.
Also, the received string should never be visible on screen
Few ways of doing that, make the field blend into the page (e.g. change the background/fore colour) or hide it by putting a div over it etc.