logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

IMAP Upload a new message
mensand
#1 Posted : Sunday, June 27, 2010 8:16:15 PM(UTC)
Rank: Newbie

Groups: Member
Joined: 6/27/2010(UTC)
Posts: 2
Points: 6
Location: Wouw Netherlands

Hi

I'm trying to create a IMAP connection to GMail where i then try to upload a new message wich has one attachement to my MailBox.
Is there a sample of doing this. I only did find a question in this forum but it has no answer ?
It's for me to use GMail as a small backup store

Greetings Andre Mens
ivx
#2 Posted : Monday, June 28, 2010 10:58:31 AM(UTC)
Rank: Administration

Groups: Administration
Joined: 9/15/2006(UTC)
Posts: 1,946
Points: 5,711
Man
Location: Estonia

Was thanked: 68 time(s) in 68 post(s)
Hi,

You just need to use IMAP client StoreMessage method.
mensand
#3 Posted : Thursday, July 01, 2010 12:22:57 AM(UTC)
Rank: Newbie

Groups: Member
Joined: 6/27/2010(UTC)
Posts: 2
Points: 6
Location: Wouw Netherlands

Hi

Thanx i've come up with the following and this works.


Mail_Message msg = new Mail_Message();
msg.MimeVersion = "1.0";
msg.MessageID = MIME_Utils.CreateMessageID();
msg.Date = DateTime.Now;
msg.From = new Mail_t_MailboxList();
msg.From.Add(new Mail_t_Mailbox("john doe", "from@domain.com"));
msg.To = new Mail_t_AddressList();
msg.To.Add(new Mail_t_Mailbox("john doe", "to@domain.com"));
msg.Subject = "This is subject text.";

MIME_b_Application application_octetStream = new MIME_b_Application(MIME_MediaTypes.Application.octet_stream);
msg.Body = application_octetStream;
msg.ContentDisposition = new MIME_h_ContentDisposition(MIME_DispositionTypes.Attachment);
application_octetStream.SetDataFromFile(@"C:\TMP\tmp\Bin\tmp.Core.dll", MIME_TransferEncodings.Base64);

MemoryStream ms = new MemoryStream();
msg.ToStream(ms, new MIME_Encoding_EncodedWord(MIME_EncodedWordEncoding.B, Encoding.UTF8), Encoding.UTF8);
ms.Position = 0;
imap.StoreMessage( "Test.Folder", IMAP_MessageFlags.None, DateTime.Now, ms, (int) ms.Length );
Guest
#4 Posted : Tuesday, August 17, 2010 7:16:04 AM(UTC)
Rank: Guest

Groups:

Message was deleted by a Moderator.
Guest
#5 Posted : Tuesday, August 17, 2010 7:25:41 AM(UTC)
Rank: Guest

Groups:

Message was deleted by a Moderator.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.044 seconds.