Click to See Complete Forum and Search --> : Sending custom Emails from C# code


sb_rkarnati
January 31st, 2008, 02:15 AM
Hi,

We need to create an email with two voting buttons (Voting buttons are std feature in Microsoft Exchange email) from a C# program.

Please let us know if any body knows how to do this or if we can get some sample code somewhere.

Thanks in advance
SB RS

MMH
January 31st, 2008, 02:19 AM
Are you using Outlook object to send the e-mail ?

sb_rkarnati
January 31st, 2008, 05:22 AM
NOt sure how to do it yet. Using outlook object is not a problem if that is the way. Or any other option is alright also.

Thanks
RS

MMH
January 31st, 2008, 06:04 AM
Here is one way of sending e-mail
( you have to set IIS for this first )

MailMessage myMail = new MailMessage();

myMail.To = "abc@hotmail.com";
myMail.From = "123@hotmail.com";
myMail.Subject = "Hi...!!";

myMail.BodyFormat = MailFormat.Html; // here you can choose: Plain or HTML

string body = "Hi from MMH...";

myMail.Body = body; //set the body message

SmtpMail.Send(myMail);

DeepT
January 31st, 2008, 08:27 AM
MMH has it right, there is full email support built into C#. Do it just like he said, it is a cake walk.

sb_rkarnati
January 31st, 2008, 10:17 PM
Thanks for the inputs MMH and DeepT.
But what I was looking for is a little different. I am aware of how to send emails from C# code. What I am looking for is the procedure to be able to use the Voting buttons feature of exchange server. Please let me know the procedure if you are aware.

Thanks again for the responses
RS

MMH
February 1st, 2008, 02:51 AM
Give some details on how you are planning to send the mail. Is it through your application ? or do you want your application to send mails through outlook ?

There are few ways of sending mails.

One method i told you. The second way is to send your mails through outlook, so here your application will be automating the mails using outlook....

sb_rkarnati
February 4th, 2008, 01:08 AM
Hi,

What we need to do is to send out emails to our customers from our C# application. The mails must have 'voting buttons' (like the ones in Microsoft Exchange or anything similar to that).
The users should be able to send replies to these emails by selecting the voting buttons.

We do not want to use the Outlook object for doing this (we initially did not know this restriction). Please let us know how we could achive this functionality.

Thanks
RS

DeepT
February 4th, 2008, 08:32 AM
I am not familiar with 'voting buttons' in outlook, however, it just seems to be a "content" problem, not an email problem. It is kind of like asking how to send HTML via email. You just send HTML, there is no magic behind it.

All outlook probably does is construct this content for you. All you need to do is either figure out how to make the content yourself, or have outlook do it, then save it, and send copies via your c# application. All you might need to do is some search and replace on the emails if they contain specific information per customer.

MMH
February 5th, 2008, 12:03 AM
Hi,

What we need to do is to send out emails to our customers from our C# application. The mails must have 'voting buttons' (like the ones in Microsoft Exchange or anything similar to that).
The users should be able to send replies to these emails by selecting the voting buttons.

We do not want to use the Outlook object for doing this (we initially did not know this restriction). Please let us know how we could achive this functionality.

Thanks
RS

So do you know which e-mail client your customers are using ? And if they are using other than outlook client, then does it support voting functionality ?

You need to make few things clear...

Allan Olesen
February 10th, 2008, 05:51 AM
What we need to do is to send out emails to our customers from our C# application. The mails must have 'voting buttons' (like the ones in Microsoft Exchange or anything similar to that).
The questions you should ask yourself before trying to do this, are:

Have you tested if the buttons survive the trip from the sender to the recipient when using Outlook/Exchange in both ends?
If not, you are trying to programmatically mimic something which does not exist.

Do those customers use Outlook/Exchange?
If not, do not expect their mail software be able to show the buttons since they are not part of any mail standard I know of.

I just ran a quick test myself. I sent a mail with voting buttons from Outlook 2003 and Exchange (presenting itself as version 6.5).

The Exchange server did not send the mail directly, but instead sent it through a virus-filtering mail server, presenting itself as "InterScan E-Mail VirusWall NT".

The recipient was using Thunderbird 2.0.0.9, and the recipient account was hosted on a Postfix 2.1.5 mailserver.

Results:
1. No voting buttons showed up in the mail when received (no surprise).

2. The raw source of the mail did not indicate any buttons (a bit more surprising since I had expected to find them in a custom header in the mail).

3. When sniffing the mail content from the communication between the VirusWall server and the Postfix server, no indication of buttons were found. In fact, no unusual content at all were found (the xxxx strings was inserted by me):

Received: from xxxx04.xxx.dk ([xxx.xxx.xxx.xxx) by xxxx03.xxxx.dk with Microsoft SMTPSVC(5.0.2195.6713);.
. Sun, 10 Feb 2008 12:18:50 +0100.
Content-class: urn:content-classes:message.
MIME-Version: 1.0.
Content-Type: text/plain;.
.charset="us-ascii".
Content-Transfer-Encoding: quoted-printable.
X-MimeOLE: Produced By Microsoft Exchange V6.5.
Subject: Test.
Date: Sun, 10 Feb 2008 12:18:49 +0100.
Message-ID: <F4ABF05720FB7B449EC912F93D00108819A4F3@xxxx04.xxxx.dk>.
X-MS-Has-Attach: .
X-MS-TNEF-Correlator: .
Thread-Topic: Test.
Thread-Index: AchrFBdFcAr478EkTWGMFsNjNkgS/g==.
From: xxxx.
To: xxxx.
Return-Path: xxxx.
X-OriginalArrivalTime: 10 Feb 2008 11:18:50.0328 (UTC) FILETIME=[B6279580:01C86BD6].
.
asdf.
..


There may be many reasons for this. Perhaps an Exchange server never includes the buttons in mails to external recipients. Perhaps it only includes them when talking directly to other Exchange servers. Perhaps they were stripped by the virus-filtering mail server.

Under all circumstances, I would consider mail buttons too fragile to use for anything important.

I think you will be better off considering some voting URLs in the mail. However, such URLs may also fall victim to a general "never click on links in mails" rule (which actually makes a lot of sense).