發送郵件時當如下 與收據發送電子郵件:PERSONA CC:personB BCC:personC的Bug MailCore通過BCC
所有的三個人將獲得的電子郵件。所有收到的電子郵件都會在收據字段中顯示personC。正如我們所知,不應顯示密件抄送聯繫人personC。爲何會發生這種情況?我正確地將CTCoreMessage
設置爲,cc和bcc。這是一個MailCore
框架的錯誤嗎?或者有什麼我錯過了?
在此先感謝!
下面是供您參考相關的代碼
- (IBAction)buttonSendPressed:(id)sender
{
[self dismissViewControllerAnimated:YES completion:^{
CTCoreMessage *testMsg = [[CTCoreMessage alloc] init];
NSMutableArray *mutArrTos = [NSMutableArray array]; // personA
NSMutableArray *mutArrCcs = [NSMutableArray array]; // personB
NSMutableArray *mutArrBccs = [NSMutableArray array]; // personC
NSLog(@"toContactArr :%@",toContactArr);
if (toContactArr.count>0) {
for (NSDictionary *dict in toContactArr) {
[mutArrTos addObject:[CTCoreAddress addressWithName:[dict valueForKey:@"name"] email:[dict valueForKey:@"email"]]];
}
NSLog(@"mutArrRecipients : %@", mutArrTos);
[testMsg setTo:[NSSet setWithArray:mutArrTos]];
}
if (ccContactArr.count>0) {
for (NSDictionary *dict in ccContactArr) {
[mutArrCcs addObject:[CTCoreAddress addressWithName:[dict valueForKey:@"name"] email:[dict valueForKey:@"email"]]];
}
NSLog(@"mutArrRecipients : %@", mutArrCcs);
[testMsg setCc:[NSSet setWithArray:mutArrCcs]];
}
if (bccContactArr.count>0) {
for (NSDictionary *dict in bccContactArr) {
[mutArrBccs addObject:[CTCoreAddress addressWithName:[dict valueForKey:@"name"] email:[dict valueForKey:@"email"]]];
}
NSLog(@"mutArrRecipients : %@", mutArrBccs);
[testMsg setBcc:[NSSet setWithArray:mutArrBccs]];
}
[testMsg setFrom:[NSSet setWithObject:[CTCoreAddress addressWithName:@"222222" email:@"[email protected]"]]];
[testMsg setBody:self.textView.text];
[testMsg setSubject:self.textField.text];
DbManager *dbManager = [[DbManager sharedManager] switchDBWithFileName:DBNAME];
User *user = [dbManager getAccount];
NSString *account = user.account;
NSString *pwd = user.password;
NSString *emailType = user.email_type;
NSLog(@"user: %@", user);
NSLog(@"account: %@", account);
NSLog(@"pwd: %@", pwd);
NSLog(@"emailType: %@", emailType);
NSError *error;
BOOL success = [CTSMTPConnection sendMessage:testMsg server:@"smtp.gmail.com" username:@"[email protected]" password:@"222222" port:25 useTLS:YES useAuth:YES error:&error];
if (!success) {
// Present the error
NSLog(@"error: %@", error);
}else{
NSLog(@"CTSMTPConnection success");
}
}];
}
我們中國人經常挖3英尺XD –
LOLZ ........... – Charan
我固定的bug,PLZ檢查我的答案。 –