Question

In Problem Set 7 you designed and implemented a Message class. This time, lets design and implement a Mailbox class in a fil
smallest id number must be located in the index 0 of the inbox array. The message with the largest id number toward the other
public class Uselailbox public static void main(String[] args) Mailbox jims - new Mailbox(Jims Box); // I am using simple
1. Jims MBox: Inbox: (0)(1)(2)(3)(4) (5) Delbox: Message (6) not in inbox. 2.Jims MBox: Inbox: (1) (2) (4) Delbox: (0)(3)(5
publie elass Message 1/ Non-statie (dynanie) fields private String from private String to private String date; private String
// Note that this one is private since I am creating it to be // used within this class alone as a helper function for is imp
messages) - Meskr. public class UseMessage public static void main(String[] args) { Message magl - new Message(); System.out.
DEPIC System.out.printlningi.tor mg1.getTo System.out.printlnl.dater mgl.getDate(); System.out.printlni nal.subject: sagi.get
0 0
Add a comment Improve this question Transcribed image text
Answer #1

import smtplib

#Email Variables

SMTP_SERVER = 'smtp.mail.com' #Email Server (don't change!)

SMTP_PORT = 587 #Server Port (don't change!)

MAIL_USERNAME = '[email protected]' #change this to match your mail account

MAIL_PASSWORD = 'yourPassword' #change this to match your mail password

class Mailbox.java:

    def sendmail(self, recipient, subject, content):

        

        #Create Headers

        headers = ["From: " + MAIL_USERNAME, "Subject: " + subject, "To: " + recipient,

                   "MIME-Version: 1.0", "Content-Type: text/html"]

        headers = "\r\n".join(headers)

        #Connect to mail Server

        session = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)

        session.ehlo()

        session.starttls()

        session.ehlo()

        #Login to mail

        session.login(MAIL_USERNAME, MAIL_PASSWORD)

        #Send Email & Exit

        session.sendmail(MAIL_USERNAME, recipient, headers + "\r\n\r\n" + content)

        session.quit

sender = Mailbox.java()

Please like.....

Add a comment
Know the answer?
Add Answer to:
In Problem Set 7 you designed and implemented a Message class. This time, let's design and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Implement the Message class using a header and implementation file named Message.h and Message.cpp respectively. In...

    Implement the Message class using a header and implementation file named Message.h and Message.cpp respectively. In addition to the two Message class files, you must write a driver. The driver must create a Message array that is capable of holding 100 messages (make sure that you don’t exceed the maximum number of Messages). It then must read all Messages from a file named messages.txt (ordered date\n sender\n recipient\n body\n), sort the Messages based on date, find a Message based on...

  • I have a little problem about my code. when i'm working on "toString method" in "Course"...

    I have a little problem about my code. when i'm working on "toString method" in "Course" class, it always say there is a mistake, but i can not fix it: Student class: public class Student {    private String firstName;    private String lastName;    private String id;    private boolean tuitionPaid;       public Student(String firstName, String lastName, String id, boolean tuitionPaid)    {        this.firstName=firstName;        this.lastName=lastName;        this.id=id;        this.tuitionPaid=tuitionPaid;    }   ...

  • Problem 1.(1) Implement a class Clock whose getHours and getMinutes methods return the current time at...

    Problem 1.(1) Implement a class Clock whose getHours and getMinutes methods return the current time at your location. (Call java.time.LocalTime.now().toString() or, if you are not using Java 8, new java.util.Date().toString() and extract the time from that string.) Also provide a getTime method that returns a string with the hours and minutes by calling the getHours and getMinutesmethods. (2) Provide a subclass WorldClock whose constructor accepts a time offset. For example, if you live in California, a new WorldClock(3) should show...

  • ​I have to create two classes one class that accepts an object, stores the object in...

    ​I have to create two classes one class that accepts an object, stores the object in an array. I have another that has a constructor that creates an object. Here is my first class named "ShoppingList": import java.util.*; public class ShoppingList {    private ShoppingItem [] list;    private int amtItems = 0;       public ShoppingList()    {       list=new ShoppingItem[8];    }       public void add(ShoppingItem item)    {       if(amtItems<8)       {          list[amtItems] = ShoppingItem(item);...

  • 1. display a dialog box which contains the message "Input a value for size (>0)"; 2....

    1. display a dialog box which contains the message "Input a value for size (>0)"; 2. assume the input is a number, check if it is less than or equal to zero. If so, display the message "Size must be > 0" in another dialog box and go to 1; I got trouble in question 2. After I display the message of "Size must be >0", how can I repeat the step in question 1 and make it like a...

  • In Java: Executable Class create an array of Employee objects. You can copy the array you...

    In Java: Executable Class create an array of Employee objects. You can copy the array you made for Chapter 20. create an ArrayList of Employee objects from that array. use an enhanced for loop to print all employees as shown in the sample output. create a TreeMap that uses Strings for keys and Employees as values. this TreeMap should map Employee ID numbers to their associated Employees. process the ArrayList to add elements to this map. print all employees in...

  • Rewrite following code down below using Factory Pattern. -------------------------Staff.java--------------------------- import java.util.*; public class Staff extends Employee...

    Rewrite following code down below using Factory Pattern. -------------------------Staff.java--------------------------- import java.util.*; public class Staff extends Employee {    private int HourlyRate;    /**Constructor Staff which initiates the values*/    public Staff() {    super();    HourlyRate=0;    }    /**Overloaded constructor method    * @param ln last name    * @param fn first name    * @param ID Employee ID    * @param sex Sex    * @param hireDate Hired Date    * @param hourlyRate Hourly rate for the work...

  • given the following two classes Within a file named Rational.java, define a public class named Rational...

    given the following two classes Within a file named Rational.java, define a public class named Rational such that … the Rational class has two private instance variables, numerator and denominator, both of type int the Rational class defines two public accessor methods, numerator() and denominator() the Rational class defines a constructor that has one String parameter a throws clause indicates that this constructor could potentially throw a MalformedRationalException this constructor throws a MalformedRationalException in the following circumstances … When the...

  • Introduction In this lab, you will be working with three classes: Person, Student, and Roster. Person...

    Introduction In this lab, you will be working with three classes: Person, Student, and Roster. Person and Student represent individuals with a first and last name as String class variables, and Student has an additional int class variable that represents a ID number. The Roster class represents a group of people that are objects of either the Person or Student class. It contains an ArrayList. The Person class has been completed for you with class variables, a constructor, and a...

  • Directions: Follow the instructions below to explore sorting objects using boxes below. You will sort the...

    Directions: Follow the instructions below to explore sorting objects using boxes below. You will sort the boxes by the largest volume. Copy and Paste the Box method below into BlueJ public class Box { private double length, height, depth;    public Box( double length, double height, double depth ) { this.length = length; this.height = height; this.depth = depth; }    public double volume() { return length*height*depth; } // compare this Box to another Box int compareTo( Box other )...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT