在我的應用程序中,我想發送電子郵件給多個收件人。 我能夠一次發送電子郵件給一個人,現在我想發送電子郵件給多個收件人。Iphone使用smtp服務器向多個收件人發送電子郵件?
我有一個nsmutable陣列* sNamesArr其內容的數據的收件人。 NSMutableArray * sNamesArr;
以下爲m的代碼:
-(void)sendEMAIL
{
NSLog(@"Paused state100");
[dictUser retain];
//Auto code
SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init];
//testMsg.fromEmail = @"Lexi mobile";//[email protected]
testMsg.fromEmail = str_uname;
NSLog(@"str_Uname=%@",testMsg.fromEmail);
// str_info = [str_info stringByReplacingOccurrencesOfString:@"," withString:@""];
// testMsg.toEmail = str_info;
// NSLog(@"autoemail=%@",testMsg.toEmail);
//str_info = [str_info stringByReplacingOccurrencesOfString:@"," withString:@""];
testMsg.toEmail = str_info;
NSLog(@"autoemail=%@",testMsg.toEmail);
testMsg.relayHost = @"smtp.gmail.com";
testMsg.requiresAuth = YES;
testMsg.login = str_uname;
NSLog(@"autoelogin=%@",testMsg.login);
testMsg.pass = str_password;
NSLog(@"autopass=%@",testMsg.pass);
testMsg.subject = @"Schedule Sms And Email";
testMsg.wantsSecure = YES;
NSString *sendmsg=[[NSString alloc]initWithFormat:@"%@",str_info2];
NSLog(@"automsg=%@",sendmsg);
testMsg.delegate = self;
NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey,
sendmsg,kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];
testMsg.parts = [NSArray arrayWithObjects:plainPart,nil];
[testMsg send];
// [self DeleteRowAfterSending];
[self performSelector:@selector(DeleteRowAfterSending) withObject:nil afterDelay:5.0];
}
退房這個http://stackoverflow.com/questions/5799112/send-email-to-multiple-recipients-with-skpsmtpmessage –