public static void sendWeeklyEmail()

in database/src/main/java/com/google/firebase/quickstart/email/MyEmailer.java [48:62]


    public static void sendWeeklyEmail(Map<String,User> users, List<Post> topPosts) {
        // TODO(developer): send email to each user notifying them about the current top posts
        System.out.println("sendWeeklyEmail: MOCK IMPLEMENTATION");
        System.out.println("sendWeeklyEmail: there are " + users.size() + " total users.");
        System.out.println("sendWeeklyEmail: the top post is " + topPosts.get(0).title + " by " + topPosts.get(0).author);

        for (String userId : users.keySet()) {
            // Mark the last time the weekly email was sent out
            // [START basic_write]
            DatabaseReference userRef = FirebaseDatabase.getInstance().getReference()
                    .child("users").child(userId).child("lastSentWeeklyTimestamp");
            userRef.setValue(ServerValue.TIMESTAMP);
            // [END basic_write]
        }
    }