EDN Admin
Well-known member
Hi,
FYI Ive been looking around for 3 days for an answer if there is any other way to list emails and show the selected message body then please let me know.
i have a email app using the chilkat imap client. i am able to get the email from the server display the subject and sender in a list box and show the body of the 1st message in a textbox however how would i go about showing the body of
the message I select in the list box i.e on selected index changed event. im only a begginer at c# so the more detail the better, bellow is the code i have already and here is the link to the chilkat email client : http://www.chilkatsoft.com/email-dotnet.asp Here
<div style="color:black; background-color:white
<pre><span style="color:green // Create an object, connect to the IMAP server, login,
<span style="color:green // and select a mailbox.
Chilkat.Imap imap = <span style="color:blue new
Chilkat.Imap();
imap.UnlockComponent(<span style="color:#a31515 "UnlockCode"
);
imap.Connect(<span style="color:#a31515 "Imap URL"
);
imap.Login(<span style="color:#a31515 "email address"
, <span style="color:#a31515 "password"
);
imap.SelectMailbox(<span style="color:#a31515 "Inbox"
);
<span style="color:green // Get a message set containing all the message IDs
<span style="color:green // in the selected mailbox.
Chilkat.MessageSet msgSet;
msgSet = imap.Search(<span style="color:#a31515 "ALL"
, <span style="color:blue true
);
<span style="color:green // Fetch all the mail into a bundle object.
Chilkat.EmailBundle bundle = <span style="color:blue new
Chilkat.EmailBundle();
bundle = imap.FetchBundle(msgSet);
<span style="color:green // Loop over the bundle and display the From and Subject.
Chilkat.Email email;
<span style="color:blue int
i;
<span style="color:blue for
(i = 0; i < bundle.MessageCount - 1; i++)
{
email = bundle.GetEmail(i);
listBox1.Items.Add(email.From + <span style="color:#a31515 ": "
+ email.Subject);
textBox1.Text = email.Body ;
}
<span style="color:green // Save the email to an XML file
bundle.SaveXml(<span style="color:#a31515 "bundle.xml"
);
<span style="color:green // Disconnect from the IMAP server.
<span style="color:green // This example leaves the email on the IMAP server.
imap.Disconnect();
}
}
[/code]
Thanks in advance
View the full article
FYI Ive been looking around for 3 days for an answer if there is any other way to list emails and show the selected message body then please let me know.
i have a email app using the chilkat imap client. i am able to get the email from the server display the subject and sender in a list box and show the body of the 1st message in a textbox however how would i go about showing the body of
the message I select in the list box i.e on selected index changed event. im only a begginer at c# so the more detail the better, bellow is the code i have already and here is the link to the chilkat email client : http://www.chilkatsoft.com/email-dotnet.asp Here
<div style="color:black; background-color:white
<pre><span style="color:green // Create an object, connect to the IMAP server, login,
<span style="color:green // and select a mailbox.
Chilkat.Imap imap = <span style="color:blue new
Chilkat.Imap();
imap.UnlockComponent(<span style="color:#a31515 "UnlockCode"
);
imap.Connect(<span style="color:#a31515 "Imap URL"
);
imap.Login(<span style="color:#a31515 "email address"
, <span style="color:#a31515 "password"
);
imap.SelectMailbox(<span style="color:#a31515 "Inbox"
);
<span style="color:green // Get a message set containing all the message IDs
<span style="color:green // in the selected mailbox.
Chilkat.MessageSet msgSet;
msgSet = imap.Search(<span style="color:#a31515 "ALL"
, <span style="color:blue true
);
<span style="color:green // Fetch all the mail into a bundle object.
Chilkat.EmailBundle bundle = <span style="color:blue new
Chilkat.EmailBundle();
bundle = imap.FetchBundle(msgSet);
<span style="color:green // Loop over the bundle and display the From and Subject.
Chilkat.Email email;
<span style="color:blue int
i;
<span style="color:blue for
(i = 0; i < bundle.MessageCount - 1; i++)
{
email = bundle.GetEmail(i);
listBox1.Items.Add(email.From + <span style="color:#a31515 ": "
+ email.Subject);
textBox1.Text = email.Body ;
}
<span style="color:green // Save the email to an XML file
bundle.SaveXml(<span style="color:#a31515 "bundle.xml"
);
<span style="color:green // Disconnect from the IMAP server.
<span style="color:green // This example leaves the email on the IMAP server.
imap.Disconnect();
}
}
[/code]
Thanks in advance
View the full article