在我的应用程序中,我想向多个收件人发送电子邮件。我能够一次向一个人发送电子邮件,现在我想向多个收件人发送电子邮件。
我有一个 nsmutable 数组 *sNamesArr ,其中包含收件人的数据。NSMutableArray *sNamesArr;
以下是m代码:
-(void)sendEMAIL
{
NSLog(@"Paused state100");
[dictUser retain];
//Auto code
SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init];
//testMsg.fromEmail = @"Lexi mobile";//nimit51parekh@gmail.com
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];
}