Assignments‎ > ‎

Lab 4b

Due TBA - 11:59pm

  1. Implement a program that repeatedly (in a loop) prompts the user for an email address and sends a pre-configured message to each address entered by the user.  The user should be able to quit the program by entering a value (such as 0 or 'quit') to end the loop.  Hints:
    1. You need to add two properties to the Properties object you create (see the Project 2 description).  The Properties object is essentially a HashMap that stores key, value pairs representing relevant properties associated with the message.  The first property you need to set is the mail server.  The key for this property should be "mail.smtp.host" and the value should be "smtp.usfca.edu".  The second property you need to set is the sender.  The key for this property should be "mail.from" and the value should be your email address.
    2. You will need to import the following classes:
      1. import java.util.Date;
        import java.util.Scanner;
        import java.util.Properties;
        import javax.mail.Message;
        import javax.mail.MessagingException;
        import javax.mail.Session;
        import javax.mail.Transport;
        import javax.mail.internet.MimeMessage;

Submission

Please submit your work in an SVN directory https://www.cs.usfca.edu/svn/<username>/cs112/lab4b

Submission Instructions
Comments