Objective-C Requires Chilkat v11.0.0+
Objective-C
Send an email with a Bcc recipient using SMTP (live send)
See more Email Object Examples
Live send. Load the previously prepared with-attachments.eml, add a Bcc recipient, and pass the Email to MailMan.SendEmail. For a real test, use a relay you control, replace the sample sender and recipients (including the Bcc address) with test mailboxes, and obtain credentials from your application’s secret store.
Chilkat Objective-C Downloads
#import <CkoEmail.h>
#import <CkoMailMan.h>
BOOL success = NO;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
CkoEmail *email = [[CkoEmail alloc] init];
success = [email LoadEml: @"with-attachments.eml"];
if (success != YES) {
NSLog(@"%@",email.LastErrorText);
return;
}
// Enable this option before adding a blind recipient to the message.
email.UncommonOptions = @"NoBccHeader";
success = [email AddBcc: @"Bcc recipient" emailAddress: @"bcc@example.net"];
if (success != YES) {
NSLog(@"%@",email.LastErrorText);
return;
}
CkoMailMan *mail = [[CkoMailMan alloc] init];
mail.SmtpHost = @"smtp.example.com";
mail.SmtpPort = [NSNumber numberWithInt:465];
mail.SmtpSsl = YES;
mail.RequireSslCertVerify = YES;
mail.SmtpUsername = @"MAIL_USER";
mail.SmtpPassword = @"MAIL_PASSWORD";
success = [mail SendEmail: email];
if (success != YES) {
NSLog(@"%@",mail.LastErrorText);
return;
}
NSLog(@"%@",@"The SMTP relay accepted the message.");
success = [mail CloseSmtpConnection];
if (success != YES) {
NSLog(@"%@",mail.LastErrorText);
return;
}