YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Tag as favorite
IMAP Upload a new message
mensand
#1 Posted : Sunday, June 27, 2010 6:16:15 PM
Rank: Newbie

Medals:

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

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
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 8:58:31 AM
Rank: Administration

Medals:

Groups: Administration
Joined: 9/15/2006
Posts: 1,278
Points: 3,707

Thanks: 0 times
Was thanked: 13 time(s) in 13 post(s)
Hi,

You just need to use IMAP client StoreMessage method.
mensand
#3 Posted : Wednesday, June 30, 2010 10:22:57 PM
Rank: Newbie

Medals:

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

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
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 );
16shoes
#4 Posted : Tuesday, August 17, 2010 5:16:04 AM
Rank: Guest

Medals:

Groups:

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Message was deleted by Moderator.
16shoes
#5 Posted : Tuesday, August 17, 2010 5:25:41 AM
Rank: Guest

Medals:

Groups:

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Message was deleted by Moderator.
Users browsing this topic
Guest
Tag as favorite
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.

SoClean Theme By Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 RC1 | YAF © 2003-2009, Yet Another Forum.NET
This page was generated in 0.051 seconds.