Voting Option Forward response to email Interop - c#

I am trying to use c# Microsoft Outlook Interop to send an email with voting options. The only issue is that I want to not receive the response but rather the responses be sent to another email address (not mine).
Currently my code sends the voting responses to myself which is not what i want. I want to send it to a given email that I provide in string format.
This is my existing code:
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem mail = app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mail.Body= "hi";
mail.VotingOptions = "Cheese;Combo;Maybe;";
mail.Recipients.Add("abc#gmail.com");
mail.Send();

Use MailItem.ReplyRecipients.Add.

Related

Sending SMS in C# using Twilio

I read all the other questions regarding this topic but none actually answers exactly my question.
I installed twilio package. added it to the C# project.
opened an account in twilio and had a number and so on.
but it seems not working
any ideas ? here's the code
using System;
using Twilio;
namespace Project_C_Sharp_Final
{
public partial class User : Form
{
private void label4_Click(object sender, EventArgs e)
{
string AccountSid = "[i wrote the sid here]";
string AuthToken = "[i wrote the authtoken here]";
var twilio = new TwilioRestClient(AccountSid, AuthToken);
var message = twilio.SendMessage("YOUR_TWILIO_NUMBER", "THE NUMBE I WANT TO SEND TO" , "Check New Offers");
}
}
}
message is not being sent...
did i write anything wrong ? did i miss anything ?
Before putting my solution, I want to re-iterate what philnash has mentioned. Testing Twilio Credentials will not actually send SMS.
If you are using test credendials then below solution will not work for you.
For error : Permission Not Enable for the region indicated by the to number, that means the country you are trying to send SMS to is not enabled in geolocation settigs of your Twilio account.
You need to loging to twilio portal and navigate to following URL.
https://www.twilio.com/user/account/settings/international
Here you can enable/disable countries for both SMS and Voice Call. Check if the country you are trying to send SMS to is enabled in that page or not. If not you can enable it and try sending SMS again.
Thanks and regards,
Chetan Ranpariya
Twilio developer evangelist here.
In the comments you say you're using the test credentials. Test credentials will not actually send any messages (or make calls) they are to make sure you're making the request correctly without costing you.
To make Twilio send messages you need to use the production credentials. If you are still on a trial account this won't cost you anything either.

How do I send an email from a WinRT/Windows Store application?

I am developing a Windows Store Application (Windows 8).
I have a need to send emails based on data and address stored in the application data and without the need of the user to type it the data or the address.
What would be the right/easy way to implement it?
EitanB
You can try with
var mailto = new Uri("mailto:?to=recipient#example.com&subject=The subject of an email&body=Hello from a Windows 8 Metro app.");
await Windows.System.Launcher.LaunchUriAsync(mailto);
The correct way would be to use Sharing. Your app should create an HTML document or Text and share it. The user would select Mail from the Share charm and the HTML/Text would become the body of the email.
See here for more info...
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh973055.aspx
This is the correct syntax to use for a mailto: link (unlike the other examples above with a mailto: which are incorrect..)
var mailto = new Uri("mailto:yourname#email.com?subject=" + subject + "&body=" + body);
await Launcher.LaunchUriAsync(mailto);
The problem with the mailto: method is if the user has no client program associated with mailto: nothing will happen.
The most reliable method to use is a web service or WCF service of some sort. Using the Share Charm while considered the 'correct' way on Windows 8, is not neccessarily the best as the user may still have no email client installed, for example if they rely on gmail.com for their email.
If you are developping a Universal WinRT Windows Phone application, you could use the "Windows.ApplicationModel.Email.EmailMessage" namespace as the "Microsoft.Phone.Tasks.EmailComposeTask" namespace doesn't work on WinRT application.
Then, uses this code to create and launch a new email.
// Create your new email message.
var em = new EmailMessage() ;
// Add as much EmailRecipient in it as you need using the following method.
em.To.Add(new EmailRecipient("yourname#yourdomain.com"));
em.Subject = "Your Subject...";
em.Body = "Your email body...";
// You can add an attachment that way.
//em.Attachments.Add(new EmailAttachment(...);
// Show the email composer.
await EmailManager.ShowComposeNewEmailAsync(em);
I hope it will solve your (or other developers) problem.
Regards.
It's always possible to connect to an SMTP server and issue commands like HELO, MAIL, RCPT, etc. Of course you'll need an SMTP server to connect to. I use this on our corporate intranet to send emails.

Silently sending an email from a Windows Phone 7 device?

Is it possible to silently send an email from a Windows Phone 7 device?
The reason I ask is because I would like to have a system from which an app will send information to a server which the server will log. I figure if I use emails it would be a lot more straightforward than some other system.
As you can probably guess from my question I'm in completely unexplored territory here.
It's possible to send emails, so long as you are running the SMTP server on your server.
Web services are designed for this sort of thing, email isn't. You won't find emails simpler. Look into WCF.
Of course you can, sending email can be achieved with the EmailComposeTask.
To use the EmailComposeTask , you must include the namespace Microsoft.Phone.Tasks .
*`Using Microsoft.Phone.Tasks ;`*
This namespace can be found in the Microsoft.Phone.dll
To send the email , create an instance of the EmailComposeTask and set the appropriate properties like
To , Subject and Body of the Email .
private void button1_Click(object sender, RoutedEventArgs e)
{
EmailComposeTask emailcomposer = new EmailComposeTask();
emailcomposer.To = "test#ginktage.com";
emailcomposer.Subject = "subject from test app";
emailcomposer.Body = "This is a test mail from Email Composer";
emailcomposer.Show();
}
When the Show method is called , the EmailComposer is opened which lets the user to click the send button to send the email
I hope it's clear :)

Easiest way to read hotmail emails

I am looking for a library or a simple way to open a hotmail inbox and read new and old emails. A sample code would be much appreciated.
Thanks SOF.
I had the same problem and the gentleman from asp.net show me this link to go download openpop: http://hpop.sourceforge.net/
The link has a test project. But all I needed was:
Pop3Client pop3Client = new Pop3Client();
pop3Client.Connect("pop3.live.com", 995, true);
pop3Client.Authenticate("user", "password");
Message message = pop3Client.GetMessage(10);
string messageText = message.ToMailMessage().Body;
if you want to go with imap protocol ... this may help : using c# .net librarires to check for IMAP messages from gmail servers

Automated processing of an Email in C#

Similar question as this one but for a Microsoft Environment.
Email --> Exchange Server -->[something]
For the [something] I was using Outlook 2003 & C# but it feels messy (A program is trying to access outlook, this could be a virus etc)
Microsoft.Office.Interop.Outlook.Application objOutlook = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.NameSpace objNS = objOutlook.GetNamespace("MAPI");
objNS.Logon("MAPIProfile", "MAPIPassword", false, true);
Is this the best way to do it? Is there a better way of retrieving and processing emails in a Microsoft environment???
This library provides you basic support for the POP3 protocol and MIME, you can use it to check specified mailboxes and retrieve emails and attachments, you can tweak it to your needs.
Here is another library, this one is for the IMAP protocol, it's very basic but also allows you to fetch complete messages, including attachments...
I've been happy with the Rebex components which provide IMAP access. Of course you need to ensure your Exchange administrators will open an IMAP port on your Exchange servers.
Using IMAP is a way to go. You can use Mail.dll IMAP component:
using(Imap imap = new Imap())
{
imap.Connect("imap.company.com");
imap.UseBestLogin("user", "password");
imap.SelectInbox();
List<long> uids = imap.Search(Flag.Unseen);
foreach (long uid in uids)
{
var eml = imap.GetMessageByUID(uid);
IMail message = new MailBuilder()
.CreateFromEml(eml);
Console.WriteLine(message.Subject);
Console.WriteLine(message.Text);
}
imap.Close(true);
}
You can download it here: Mail.dll email component.
I am trying http://csharpopensource.com/openpopdotnet.aspx, it have been recently updated and it is not bad. It lack good documentation but it also work with gmail/ssl.

Categories

Resources