Отправка электронной почты 2 получателям с помощью SKPSMTPMessage
Я использовал SKPSMTPMessage в своем приложении для iPhone. Проблема с несколькими получателями. Мне просто нужно отправить письмо двум получателям.
Я использую следующий код:
-(void)sendEmail {
// create soft wait overlay so the user knows whats going on in the background.
[self createWaitOverlay];
//the guts of the message.
SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init];
testMsg.fromEmail = @"support@dsfaes.co.uk";
// testMsg.toEmail = phone;
testMsg.toEmail=@"manjinderr@gmail.com;
testMsg.relayHost = @"smtp.nman.co.uk";
testMsg.requiresAuth = YES;
testMsg.login = @"support@man.co.uk";
testMsg.pass = @"nfsdxsdfswdrt";
testMsg.subject = @"The Confirmation";
testMsg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS!
// Only do this for self-signed certs!
// testMsg.validateSSLChain = NO;
testMsg.delegate = self;
}
Кто-нибудь знает, как я могу отправить письмо 2 получателям
1 ответ
Решение
Здесь heck
решение для этого
Сначала создайте массив receientsArray, который содержит ваших получателей
NSArray* recipientsArray = [NSArray arrayWithObjects:@"abc@abc.com",@"xyz@xyz.com",nil];
Вызовите метод sendEmail
for(NSString* toEmailAddress in recipientsArray){
[self sendEmail:toEmailAddress];
}
Затем определите свой метод sendEmail:
-(void)sendEmail:(NSString*)_toEmailAddress {
// create soft wait overlay so the user knows whats going on in the background.
[self createWaitOverlay];
//the guts of the message.
SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init];
testMsg.fromEmail = @"support@dsfaes.co.uk";
testMsg.toEmail = _toEmailAddress;
testMsg.relayHost = @"smtp.nman.co.uk";
testMsg.requiresAuth = YES;
testMsg.login = @"support@man.co.uk";
testMsg.pass = @"nfsdxsdfswdrt";
testMsg.subject = @"The Confirmation";
testMsg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS!
// Only do this for self-signed certs!
// testMsg.validateSSLChain = NO;
testMsg.delegate = self;
}