Delete message using AE.Net.Mail - c#

I'm trying to delete some specific emails. I'm using AE.Net.Mail. I tried a few thinks but nothing worked yet. I've read about expunge, somethink that could work. So far it hasn't and i have the feeling it doesn't work with AE.Net.Mail.
So can you guys help me out?
I filter the messages like this:
var Mail = imap.SearchMessages(SearchCondition.Subject("Generated Report"));!

Have you tried the following?
List<Lazy<MailMessage>> Mail = imap.SearchMessages(
SearchCondition.Subject("Generated Report")).ToList();
imap.DeleteMessage(Mail.First().Value);
imap.Expunge();

Related

Redemption GetRDOObjectFromOutlookObject creates conflicting issues on save

I am currently using GetRDOObjectFromOutlookObject to get the RDOAttachment object from outlook attachment. Although I could successfully use the object for the functionality I needed to achieve. Once the mail item is sent , outlook triggers a save and there I have conflicting issue that causes the outlook repair tool error. I realized that this happens when two copies of the same message is opened, Outlook fails to save the mail and throws the error. How do I overcome this issue?
foreach (Outlook.Attachment at in mail.MailItem.Attachments)
{
Redemption.IRDOAttachment rDOAttachment;
rDOAttachment = Globals.ThisAddIn.session.GetRDOObjectFromOutlookObject(at);
rDOAttachment.DisplayName = at.DisplayName;
Is this a bug in redemption or am I missing something here?
I used the below code by getting RDOAttachments from RDOMail rather than GetRDOObjectFromOutlookObject.
RDOMail msg = Globals.ThisAddIn.session.GetMessageFromID(redemptionMailItem.Item.EntryID);
RDOAttachments redemptionAttachments = msg.Attachments;
This solved the issue, But having said that there is a bug GetRDOObjectFromOutlookObject, that makes it unreliable to use it.

MikroTik and c# API: get radio-name with ':put' command

I have an issue. I want to get radio-name through the C# api for winbox. In winboxs terminal works :put [/interface wireless get [/interface wireless find default-name=wlan1] radio-name] command, but not in C# api. I rode that, in api i can't uses [ ] marks, but i dont know how it write without it. I tried like this:
mikrotik.Send("/put ", true);
mikrotik.Send(".system identity get name", true);
foreach (string h in mikrotik.Read())
{
mkResult += h;
}
l_identify.Text = mkResult;
but its doesn't work. Everytime i get this:
!trap=category=0=message=no such command or directiory (put [)!trap=message=no such command prefix!done
Please help :<
PS: Sorry for my English :P
You are sending incorrect commands to the device.
You need to use this:
/interface/wireless/print
=.proplist=radio-name
?default-name=wlan1
.proplist contains list of fields to be returned, ?default-name=wlan1 is a condifion for filtering.
You can find more about Mikrotik API syntax in the official Wiki.

Read Undelivered email body in C# windows form

I am developing one tool to keep track of emails and would like to trace the emails undelivered to sender.
I dont want to use any third party tool or any external reference
What I have tried?
-To read report Item but Body is in Chinese like language
-Googled on some solutions but nothing is working i.e. solution is related to
//PR_TRANSPORT_MESSAGE_HEADERS
link to get property name "http://schemas.microsoft.com/mapi/proptag/0x0C1A001F"
outlook PropertyAccessor class
PropName link is not working anymore.
Could anyone here please help me I would like to get from which sender the email delivery is failed.
Thank you in advance.
The PR_TRANSPORT_MESSAGE_HEADERS property contains the same Diagnostic information shown in the body. You just need to read it using the PropertyAccessor class and parse the string with From and To entries.
Outlook.PropertyAccessor oPA = reportItem.PropertyAccessor;
string transportHeaders = (string)oPA.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001E");

Outlook C# - How do I determine if user replied to a message?

In code, I want to get the reply status, the one outlook use to display "You replied to this message on ...".
I tried looking at all MailItem properties but I can't find anything which look like that.
Thanks in advance,
Nico
string SchemaTransportHeader = #"http://schemas.microsoft.com/mapi/proptag/0x10820040";
string repliedOn = oMailItem.PropertyAccessor.GetProperty(SchemaTransportHeader).ToString();
It will return empty if it hasn't been replied to or the DateTime that it has.

Emailing the contents of a Textbox with Outlook

I have a simple application written that allows users to pick inventory items with checkboxes. When the items are checked a textbox is populated showing the user's input. I would like to have a class that would take the contents of the textbox and copy it to a new outlook email with the TO address pre-populated with myemail#gmail.com. ASP.Net is foreign to me and I am a very new C# coder SO I have no idea how to do this. Any ideas.
I have seen an example online as follows...
System.Web.Mail.MailMessage message=new System.Web.Mail.MailMessage();
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1 );
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername","SmtpHostUserName" );
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword","SmtpHostPassword" );
message.From="from e-mail";
message.To="to e-mail";
message.Subject="Message Subject";
message.Body="Message Body";
System.Web.Mail.SmtpMail.SmtpServer="SMTP Server Address";
System.Web.Mail.SmtpMail.Send(message);
but I have errors everywhere and think that I'm not implementing this right. Is there a simpler way to do this or just a way I might be able to understand. Thanks to any and all answers. I can only check one but I appreciate them all.
http://support.microsoft.com/kb/310263
I am guessing you are not using the Outlook object library. If you want to, then the code is right there.
The only change you will have to make will be
oMsg.Body = TextBox1.text;
where TextBox1 has the all the contents that you wanted to send as the message body.

Categories

Resources