SQL データベースからこのような値のリストがあります。
UserName Email ComputerName DateIssued
jjsmith jjsmith@example.com JTComputer 9/14/2013
ltjoseph ltjoseph@example.com LTComputer1 10/21/2013
KTsmith KevinTem@example.com KTComputer1 01/25/2012
ltjoseph ltjoseph@example.com LTComputer2 01/11/2013
KTsmith KevinTem@example.com KTComputer2 01/25/2012
リストをオブジェクトの配列に変換します。
var user_array = [
{"username":"jjsmith", "email":"jjsmith@example.com", "computerName":"JTComputer", "dateissued":"10/21/2013"}
{"username":"ltjoseph", "email":"ltjoseph@example.com", "computerName":"LTComputer1", "dateissued":"10/21/2013"}
{"username":"KTsmith", "email":"KevinTem@example.com", "computerName":"KTComputer1", "dateissued":"01/25/2012"}
{"username":"ltjoseph", "email":"ltjoseph@example.com", "computerName":"LTComputer2", "dateissued":"01/11/2013"}
{"username":"KTsmith", "email":"KevinTem@example.com", "computerName":"KTComputer2", "dateissued":"01/25/2012"}]
ユーザーに電子メールを送信する関数が他の誰かによって作成されました。この関数は、文字列である 2 つのパラメーターのみを受け入れます。そのため、ユーザーごとに複数のメールを送信したくありません。そのため、文字列のサンプル セットが次のようになるように、アイテムを組み合わせる方法を見つけようとしています。
var str1 = "ltjoseph@example.com";
var str2 = "ltjoseph, LTComputer1-10/21/2013, LTComputer2-01/11/2013";
次に、他のユーザー関数を起動して、リスト内の各アイテムの電子メールを送信します。
function sendEmails(str1, str2);
誰かが私がこれを行う方法を知っているなら。お知らせ下さい..