2016-02-22 85 views
2

我正在使用郵箱應用程序我正在嘗試回覆郵件。使用gmail API回覆郵件ios

我已經通過了文件。

GTLQueryGmail *query = [GTLQueryGmail queryForUsersMessagesSendWithUploadParameters:nil]; 
query.message = gtlGmailMessage; //parent message 
[self.service executeQuery:query 
        delegate:self 
     didFinishSelector:@selector(displayResult:finishedWithObject:error:)]; 

我需要知道我需要在gtlGmailMessage中做什麼來回復父郵件。

在此先感謝。

+0

*我已經瀏覽了文檔*,但是您找不到如何回覆電子郵件? – Raptor

+0

沒有針對iOS的GTLGmailQuery Class的特定文檔。如果你發現請讓我知道 –

+1

使用'threadId' – jose920405

回答

0

得到了解決方案。

我們必須做所有的事情與原始領域。

GTLQueryGmail *query = [GTLQueryGmail queryForUsersMessagesSendWithUploadParameters:nil]; 
NSString *strRaw = [NSString stringWithFormat:@"To:%@\nSubject:%@\nThreadId:%@\nReply-To:%@\n\n\n%@",strToBeRep,mail.subject,mail.threadId,strToBeRep,msgToBeSend]; 
NSData *messageBody = [strMessageBody dataUsingEncoding:NSUTF8StringEncoding]; 
GTLGmailMessage *message =[[GTLGmailMessage alloc]init]; 
query.userId = @"me"; 
NSString *base64Encoded = [messageBody base64EncodedStringWithOptions:0]; 

message.raw = base64Encoded; 

message.snippet = @"sadfasdfasd dafvasdvas dafvasdv"; 
base64Encoded = [base64Encoded stringByReplacingOccurrencesOfString:@"/" withString:@"_"]; 
base64Encoded = [base64Encoded stringByReplacingOccurrencesOfString:@"+" withString:@"-"]; 
message.threadId = self.mail.mail.threadId; 
query.message = message; 

[self.service executeQuery:query 
        delegate:self 
     didFinishSelector:@selector(displayResultForNewMessage:finishedWithObject:error:)]; 


- (void)displayResultForNewMessage:(GTLServiceTicket *)ticket finishedWithObject:(GTLGmailMessage *)emailsResponse error:(NSError *)error 
{  
if(!error) 
    NSLog(@"Success"); 
} 
相關問題