librelist archives

« back to archive

Add message to folder through IMAP

Add message to folder through IMAP

From:
Jose Villar
Date:
2012-08-04 @ 18:19
I'm trying to add a message to the Gmail drafts folder without actually
sending the message. I found this post on StackOverflow which suggests this
can be done through IMAP

http://stackoverflow.com/questions/1206275/creating-messages-ie-drafts-in-gmail-with-imap-smtpThe
answer refers to a function in PHP imap_append(). Is there an
equivalent in MailCore? The online docs document a method -
(BOOL)copyMessage:(CTCoreMessage *)*msg* toPath:(NSString *)*path *but this
was changed to copyMessageWithUID:toPath: so it's obviously meant for
messages that are already on the server.

Jose

Re: Add message to folder through IMAP

From:
Jose Villar
Date:
2012-08-05 @ 08:44
There's a mailimap_append() function in mailimap.h in LibEtPan.

On Sat, Aug 4, 2012 at 8:19 PM, Jose Villar <ralliveso@gmail.com> wrote:

> I'm trying to add a message to the Gmail drafts folder without actually
> sending the message. I found this post on StackOverflow which suggests this
> can be done through IMAP
> 
http://stackoverflow.com/questions/1206275/creating-messages-ie-drafts-in-gmail-with-imap-smtpThe
answer refers to a function in PHP imap_append(). Is there an
> equivalent in MailCore? The online docs document a method -
> (BOOL)copyMessage:(CTCoreMessage *)*msg* toPath:(NSString *)*path *but
> this was changed to copyMessageWithUID:toPath: so it's obviously meant
> for messages that are already on the server.
>
> Jose
>

Re: [mailcore] Re: Add message to folder through IMAP

From:
Matt Ronge
Date:
2012-08-05 @ 17:01
Also check out mailfolder_append() which may be easier to use. Call [msg 
render] to get content to append

Matt

Sent from my iPhone

On Aug 5, 2012, at 3:44 AM, Jose Villar <ralliveso@gmail.com> wrote:

> There's a mailimap_append() function in mailimap.h in LibEtPan.
> 
> On Sat, Aug 4, 2012 at 8:19 PM, Jose Villar <ralliveso@gmail.com> wrote:
> I'm trying to add a message to the Gmail drafts folder without actually 
sending the message. I found this post on StackOverflow which suggests 
this can be done through IMAP 
http://stackoverflow.com/questions/1206275/creating-messages-ie-drafts-in-gmail-with-imap-smtp
The answer refers to a function in PHP imap_append(). Is there an 
equivalent in MailCore? The online docs document a method - 
(BOOL)copyMessage:(CTCoreMessage *)msg toPath:(NSString *)path but this 
was changed to copyMessageWithUID:toPath: so it's obviously meant for 
messages that are already on the server.
> 
> Jose
> 

Re: [mailcore] Re: Add message to folder through IMAP

From:
Jose Villar
Date:
2012-08-07 @ 21:50
mailfolder_append() resulted in a crash for me, so I ended up successfully
using mailimap_append_simple()

Thanks

On Sun, Aug 5, 2012 at 7:01 PM, Matt Ronge <mronge@mronge.com> wrote:

> Also check out mailfolder_append() which may be easier to use. Call [msg
> render] to get content to append
>
> Matt
>
> Sent from my iPhone
>
> On Aug 5, 2012, at 3:44 AM, Jose Villar <ralliveso@gmail.com> wrote:
>
> There's a mailimap_append() function in mailimap.h in LibEtPan.
>
> On Sat, Aug 4, 2012 at 8:19 PM, Jose Villar <ralliveso@gmail.com> wrote:
>
>> I'm trying to add a message to the Gmail drafts folder without actually
>> sending the message. I found this post on StackOverflow which suggests this
>> can be done through IMAP
>> 
http://stackoverflow.com/questions/1206275/creating-messages-ie-drafts-in-gmail-with-imap-smtpThe
answer refers to a function in PHP imap_append(). Is there an
>> equivalent in MailCore? The online docs document a method -
>> (BOOL)copyMessage:(CTCoreMessage *)*msg* toPath:(NSString *)*path *but
>> this was changed to copyMessageWithUID:toPath: so it's obviously meant
>> for messages that are already on the server.
>>
>> Jose
>>
>
>

Add message to folder through IMAP

From:
Denis Kutlubaev
Date:
2012-10-26 @ 17:15
Could anybody help please with usage of this method: 
mailimap_append_simple? I am trying to send a draft of a message to the 
server.

   // Preparing parameters for mailimap_append_simple function
    NSString *MIMEString = [self generateMIME];
    NSLog(@"MIME String:%@", MIMEString);
    const char *mimeString = [MIMEString UTF8String];
    size_t size = sizeof(mimeString);    
    const char *mailbox = [@"Drafts" cStringUsingEncoding:NSUTF8StringEncoding];
    
    // Sending the draft to the server
    int resultCode = 
mailimap_append_simple(draftsFolder.mcAccount.coreAccount.session, 
mailbox, mimeString, size);
    NSLog(@"Result code:%d", resultCode);
    if (resultCode == MAILIMAP_NO_ERROR) {
        NSLog(@"Success");
    }
    else if (resultCode == MAILIMAP_ERROR_STREAM) {
        NSLog(@"Error: MAILIMAP_ERROR_STREAM");
    }
    else if (resultCode == MAILIMAP_ERROR_FATAL){
        NSLog(@"Error: MAILIMAP_ERROR_FATAL");
    }

I get FATAL error. I guess, I am not using the method correctly.

Regards, 
Dennis Kutlubaev





Re: [mailcore] Add message to folder through IMAP

From:
Matt Ronge
Date:
2012-10-30 @ 01:00
Did it end up being a problem with the MIME?
--
Matt Ronge

iOS Developer & Consultant
Central Atomics Inc.
http://www.centralatomics.com






On Oct 26, 2012, at 12:15 PM, Denis Kutlubaev <kutlubaev.denis@gmail.com> wrote:

> Could anybody help please with usage of this method: 
mailimap_append_simple? I am trying to send a draft of a message to the 
server.
> 
>    // Preparing parameters for mailimap_append_simple function
>     NSString *MIMEString = [self generateMIME];
>     NSLog(@"MIME String:%@", MIMEString);
>     const char *mimeString = [MIMEString UTF8String];
>     size_t size = sizeof(mimeString);    
>     const char *mailbox = [@"Drafts" cStringUsingEncoding:NSUTF8StringEncoding];
>     
>     // Sending the draft to the server
>     int resultCode = 
mailimap_append_simple(draftsFolder.mcAccount.coreAccount.session, 
mailbox, mimeString, size);
>     NSLog(@"Result code:%d", resultCode);
>     if (resultCode == MAILIMAP_NO_ERROR) {
>         NSLog(@"Success");
>     }
>     else if (resultCode == MAILIMAP_ERROR_STREAM) {
>         NSLog(@"Error: MAILIMAP_ERROR_STREAM");
>     }
>     else if (resultCode == MAILIMAP_ERROR_FATAL){
>         NSLog(@"Error: MAILIMAP_ERROR_FATAL");
>     }
> 
> I get FATAL error. I guess, I am not using the method correctly.
> 
> Regards, 
> Dennis Kutlubaev
> 
> 
> 
> 
> 
>