I want to send two buttons in email. On clicking of that buttons user should be able to Approve or Reject approval. It should work on gmail as well as outlook. I am not sure if web api will work. I am using c# for sending email. Please share any idea.
Email clients (Outlook as well) don't allow executing any JavaScript code in the message body for security reasons. The best what you could do for all mail clients is to paste a hyperlink in the message body and count responses on the server side when users click it.
As for for Outlook, you can use the MailItem.VotingOptions property which allows setting a string specifying a delimited string containing the voting options for the mail message.
Voting options on messages are used to give message recipients a list of choices and to track their responses. To create voting options programmatically, set a string that is a semicolon-delimited list of values for the VotingOptions property of a MailItem object. The values for the VotingOptions property will appear under the Vote command in the Respond group in the ribbon of the received message.
using Outlook = Microsoft.Office.Interop.Outlook;
private void OrderPizza()
{
Outlook.MailItem mail = (Outlook.MailItem)Application.CreateItem(
Outlook.OlItemType.olMailItem);
mail.VotingOptions = “Cheese; Mushroom; Sausage; Combo; Veg Combo;”
mail.Subject = “Pizza Order”;
mail.Display(false);
}
Related
I sent an e-mail with voting buttons from Outlook in C#. The code is below. Mails send correctly and the receiver answer the vote, there is no problem in here too.
Outlook._Application _app = new Outlook.Application();
Outlook.MailItem mail = (Outlook.MailItem)_app.CreateItem(Outlook.OlItemType.olMailItem);
mail.To = "xxx#abc.com";
mail.Subject = "this is subject";
mail.Body = "this is body";
mail.Importance = Outlook.OlImportance.olImportanceNormal;
mail.VotingOptions = "Agree;Disagree";
((Outlook.MailItem)mail).Send();
MessageBox.Show("mail sent");
My problem is I have a SQL Server database and in my database looks like (table name is INFO);
USERS MAIL STATUS
Jack jack#xyz.com on hold
Simon simon#xyz.com on hold
When the receiver answer the mail how can I update my STATUS.
To explain with an example; I send and e-mail to Jack with voting buttons("Agree;Disagree") on Outlook with my C# program (Windows Form). Jack get the message and responds to my email with the voting panel. After he answers it an e-mail comes and it says sender reply:Agree or sender reply:Disagree.
How can I update status "on hold" to "Agree" where the user name is Jack.
You need to handle the NewMailEx event of the Application class which is fired when a new message arrives in the Inbox and before client rule processing occurs. You can use the Entry ID returned in the EntryIDCollection array to call the NameSpace.GetItemFromID method and process the item.
The VotingResponse property of the MailItem class returns a string specifying the voting response for the mail message. This property is usually set to one of the delimited values returned by the VotingOptions property on a reply to the original message.
I have textbox which shows the content of mail body.
While forwarding mail original mail body if content is edited by pressing any key then user id should get appended. Please let me know how should I do this in WPF.
Before sending the mail
if(edits_made) // bool value which indicates if changes have been made
{
yourtextbox.Text.Insert(0, userid);
}
Not before sending an mail.
Similar functionality is there in outlook as well.
Add < prefix to original mail if content is modified.
Same I am trying to build in WPF.
I want to send a reply to say a particular mail from my Outlook mailBox.
I intend to find the mail by searching the mailbox using the subject/body/sender and then reply to the found mail.
I have succeeded in searching the mail from the mailbox using C#, but i'm not able to reply to the mail.
And also if i use the reply will it be the exact replica of the action performed in outlook i.e. if replied on a mail, will the subject be added with RE: or we need to manually append the text to subject?
Please spare my Ignorance
Any help will be appreciated
The following code is an extract
Lets assume you've picked your item, here I picked one by a number..
MailItem m = objFolder.Items[t];
m.ReplyAll();
This effectively hits "ReplyAll" and fills all the things in as if outlook did it..(because it did) eg, add stuff to the body.. hit send.
Goutham gauti its right. All changes that you make in your mail item will be response. But if you want more information you can read this article on CodeProject:
http://www.codeproject.com/Articles/1106804/Create-and-send-an-email-reply-in-Csharp-VB-NET
private void ReplyToMail(Outlook.MailItem mailItem)
{
//mailItem is the mail you wand to reply to
Outlook.MailItem replyMail = mailItem.Reply();
//you can use replyAll insted
replyMail.Body = "the mail body text";
((Outlook._MailItem)replyMail).Send();
}
Introdution
I am currently working a system develop with C#.
The system is about request approval.
When a request made, system will send email to user ask for response.
User's response will as simple as approve, reject or request update.
Question/Problem
Is it possible to have a button (approve or reject) in email content which allow user to response to system with only one click but without open browser?
Or, Is it possible to create button in email content which enable user to click to create new email with pre-set subject and recipient like following:
subject: request id - 123 - action - approve
to: response#system.com
as response email for user to send.
Then system can then recognize the email received and perform required back-end process.
Research Done
Research 1
What I currently found was outlook appointment email.
it done like second solution create new email with content for user send a response.
But, it only have options accept, decline and tentative.
And, I am not sure is blackberry support it like outlook.
The following is the blog found to create appointment email:
http://chuckdotnet.blogspot.my/2007/10/send-outlook-meeting-requests-with.html
Research 2
The following website teach you how to create hyperlink in email content which can create new email with pre-populate subject, body, and recipient
https://community.articulate.com/discussions/building-better-courses/hyperlink-to-create-an-already-written-email
However, No test had perform in blackberry yet.
Appreciate for any suggestion from you guys and I willing to try.
Is it possible to sent an email with button which can click to create
email with some pre-set content?
Yes, this is possible, see the System.Net.Mail code in the .NET framework.
https://msdn.microsoft.com/en-us/library/system.net.mail(v=vs.110).aspx
You can also see this StackOverflow question about how this is used.
Send e-mail via SMTP using C#
MailMessage mail = new MailMessage("you#yourcompany.com", "user#hotmail.com");
SmtpClient client = new SmtpClient();
client.Port = 25;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Host = "smtp.google.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body";
client.Send(mail);
Finally, your code should fire a serverside post on button click to have the server take care of sending the email. If data needs to be posted to the server, you may want to consider putting this data in a form input, which will post to your controller. You can then take that data and build the email with the example I provided in the links.
I'm using MailChimp for .NET sending mails, but the wrapper for the recipient doesn't contain a type, which the is necessary for sending massmails.
MailChimp.Types.Mandrill.Messages.Recipient recipient = new MailChimp.Types.Mandrill.Messages.Recipient(member.EMail, member.Name);
Is it me who has missed something?
Quoted from MailChimp. Scroll down to "Tips for creating your HTML Campaign".
MailChimp does not use a BCC field as each recipient on your list is hidden from all other recipients on your list. We deliver a completely separate copy of your email to each recipient on your list, allowing you to personalize your content for each recipient, track clicks and opens, and address each email to the recipient's name.
I decided to use MCAPI.NET and changed the source adding a attribute to Recipient with name "to".
Setting this attribute to value "BCC" solved the problem.
Note : MailChimp is a Newsletter sending software where Mandrill is a transactional mail sending component.