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.
Related
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);
}
I tried sending mails with the help of send grid mail service using .Net core.
var client = new SendGridClient(xxxxxxxxxxxxxxxxxxxxxx);
var from = new EmailAddress("test#abc.com", "Not User");
var subject = "TestMail";
var to = new EmailAddress("test#abc.com, "Example User");
var plainTextContent = "This is body";
var htmlContent = "";
var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
client.SendEmailAsync(msg).Wait();
The mails sent using this code are not visible in sent items of my mail box. What is the possible solution to this? Thanks in advance.
When you send the email it uses SMTP directly to sendgrid. When you send via Google they will automatically add it to your outbox. To do the same when someone else sends the message you would have to manually place a copy of the sent message in your outbox using IMAP.
What is the possible solution to this?
You could use SendGrid's BCC option will allow you to BCC an email address, in this case your mail account, with every email sent.
Go to your SendGrid Account>Manage>Settings>Mail Settings and turn on the BCC option.
Note: With this setting turned on, you will be charged an extra email for every email you send. So reclick on Manage and you will see the popup message.
Here is Send mailbox snapshot:
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 want to allow the user of the handheld device software I'm working on to send me email (the contents of a log file, which will have exception data and other info for debugging).
How can I do that? All the user should have to do, on seeing the contents of the log file (which I display to them on-demand in a form), is to mash a "send this" button. The contents of the log file (which can be read from the Textbox in which they are displaying) can be the body of the email message (rather than an attachment), with the subject line being something like "{user name} log contents"
If I have to prompt the user for their email address, that's probably okay, but I would prefer to use one of our email addresses as the sender, so that it's seen as being both from us and to us (probably two different accounts, though).
One way would to use the SDF and the OpenNETCF.Net.Mail namespace objects. It works like the System.Net.Mail objects, so sending an email would look something like this:
var message = new MailMessage();
message.From = new MailAddress("sender#mydomain.com");
message.To.Add(new MailAddress("recipient#domain.com"));
message.Subject = "Hello World";
message.Body = "This is my message body";
var client = new SmtpClient();
client.Host = "smtp.myserver.com";
client.Credentials = new SmtpCredential("myusername", "mypassword", "mydomain");
client.Send(message);
So im implementing a mailservice in our webapp that users can utilize to send out emails to persons on a certain list. Now i need to know how to best use the System.Net.Mail object to send mail on the users behalf. Ive been trying this now for a while without the right results.
I would like the mail to read "our system on behalf of user 1" and the reply to adress should be the adress that user1 has in our system so that when the contacted person wants to reply to the mail he should get user1:s address, not ours. How can I do this?
Which fields do I need to declare and how? This is how i have it set up right now, but a reply to these settings sends a mail back to noreply#oursystem.com
from = 'noreply#oursystem.com'
replyTo = 'user1#privateaddress.com'
to = 'user1#privateaddress.com'
sender = 'user1#privateaddress.com'
cc = ''
ReplyTo is obsolete. You should use ReplyToList
Example:
MailAddress mailFrom = new MailAddress("noreply#oursystem.com");
MailAddress mailTo = new MailAddress("user1#privateaddress.com");
MailAddress mailReplyTo = new MailAddress("user1#privateaddress.com");
MailMessage message = new MailMessage();
message.From = mailFrom;
message.To.Add(mailTo); //here you could add multiple recepients
message.ReplyToList.Add(mailReplyTo); //here you could add multiple replyTo adresses
This was caused by a programming error on the receiving end. The correct solution is to set the from and replyto as above. That will get the correct behaviour.