When sending an email with receipts as following to: personA cc: personB bcc :personC
All the three person will get the email. And all the received emails will display personC in the receipts field. As we know the bcc contacts personC should not be displayed. Why could this happen? I correctly set the CTCoreMessage
with to, cc and bcc. Is this a bug of MailCore
Framework? Or is there something i missed?
Thanks in advance!
The following is the related code for your reference
- (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:@"letibe.xx@gmail.com"]]];
[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:@"letibe.xx@gmail.com" password:@"222222" port:25 useTLS:YES useAuth:YES error:&error];
if (!success) {
// Present the error
NSLog(@"error: %@", error);
}else{
NSLog(@"CTSMTPConnection success");
}
}];
}