2013-10-09 2 views
2

에 보낼 때 작동하지 않습니다. 따라서 내 email.send가 작동하지만 한 사용자에게만 이메일을 보내는 경우에만 작동합니다. 여기 는 meteor.method 내부 코드이다meteor.js email.send가 사용자 배열

sendEmail: function (to, from, subject, text) { 
    check([to, from, subject, text], [String]); 

    this.unblock(); 

    Email.send({ 
     to: to, 
     from: from, 
     subject: subject, 
     text: text 
    }); 
} 

});

작업 클라이언트 코드 :

Meteor.call('sendEmail', 
      '[email protected]', 
      '[email protected]', 
      'test', 
      'testing meteor email'); 

작동하지 : 내가 여기서 무엇을

Meteor.call('sendEmail', 
       ['[email protected]','[email protected]','[email protected]'], 
       '[email protected]', 
       'test', 
       'testing meteor email'); 

를 놓친 거지? 이것은 docs.meteor가 "문자열 또는 문자열 배열에"라고 말합니다. RFC5322 "다음과 같이하십시오."주소 : [주소] [0123]

답변

4

v0.6.5.1에서 Email.send을 테스트했지만 배열을 to에 전달할 때 검사가 실패하므로 코드가 실행되지 않습니다. 작성된 것처럼 모든 입력을 문자열로보고 있습니다. 당신은 같은 그것을 수정하는 경우 :

check(to, Match.OneOf(String, [String])); 
check([from, subject, text], [String]); 

그럼 당신은 문자열이나 sendEmail에 배열을 전달 할 수 있으며 작동합니다.