首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用SKPSMTPMessage向2个收件人发送电子邮件

使用SKPSMTPMessage向2个收件人发送电子邮件
EN

Stack Overflow用户
提问于 2011-08-14 04:46:13
回答 1查看 1K关注 0票数 0

我在iPhone应用程序中使用了SKPSMTPMessage。问题出在多个收件人。我只需要发送电子邮件给两个收件人。

我使用了以下代码:

代码语言:javascript
复制
-(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个收件人发送电子邮件

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-08-14 05:24:05

有一个heck解决方案可以解决这个问题

首先创建包含收件人的recipientsArray

代码语言:javascript
复制
NSArray* recipientsArray = [NSArray arrayWithObjects:@"abc@abc.com",@"xyz@xyz.com",nil];

叫你sendEmail方法

代码语言:javascript
复制
for(NSString* toEmailAddress in recipientsArray){
   [self sendEmail:toEmailAddress];
}

然后定义您的sendEmail方法:

代码语言:javascript
复制
-(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;
}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7053168

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档