Change value of To field in compose window

L

Lokesh

I have to change the value of "To" field in the compose/reply window in the send event method. The change occurs appropriately but,once the mail is sent, the item is placed in the sent folder but the recipient does not recieve the mail. If the mail is sent without changing the "To" field, it works fine. Can we not change the value of "To" field in send event?

I am using Applicaiton.ItemSend

Here is the code for it:
private void Composed_Mail_Send(Object obj, ref bool boolVar)
{
string assigneeStr = null;
Outlook.MailItem curItem;
MessageBox.Show("Send button clicked");

if (trackBtn.State == Office.MsoButtonState.msoButtonDown)
{
try
{
curItem = (Outlook.MailItem)curApp.ActiveInspector().CurrentItem;
assigneeStr = curItem.To;
curItem.RecipientReassignmentProhibited = false;
MessageBox.Show(curItem.To);
curItem.AlternateRecipientAllowed = true;
MessageBox.Show("Assignee:" +assigneeStr);
curItem.To = curBA.email;
MessageBox.Show("From:"+curItem.SenderEmailAddress
+"\n To:" +curItem.To);
curItem.Body = "/assignee:" + assigneeStr +
;
MessageBox.Show(curItem.Body);
}
catch (Exception exp)
{
MessageBox.Show(exp.StackTrace +"\n"+"Message:" + exp.Message);
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top