Hello,

I am new to java and android and I am trying to develop an application that needs to be able to send email. So far I have been able to do this with an intent to gmail but I would much rather have it send automatically (without opening another app). This is what I have tried so far:

I have included mail.jar, additional.jar, and activation.jar and added them all to the build path. I know that is not the problem because when I remove them from the build path I get actual errors and not exceptions. In the code I have posted below I flagged where I am getting the exceptions. I have tried everything and I would much appreciate a fix to this or an entirely different solution that accomplishes my goal. Thanks in advance!

Java Code:
//SEND EMAIL
    		    		String host = "smtp.gmail.com";
    		String from = "myemail@gmail.com";
    		String to = "myemail@gmail.com";
    		Properties props = System.getProperties();
    		props.put("mail.smtp.host", host);
    		props.put("mail.smtp.user", from);
    		props.put("mail.smtp.password", "mypassword");
    		props.put("mail.smtp.port", "587"); // 587 is the port number of yahoo mail
    		props.put("mail.smtp.auth", "true");

    		Session session = Session.getDefaultInstance(props, null);
    		MimeMessage message = new MimeMessage(session); //No error here. This is fine.
    		
    		InternetAddress from_address = new InternetAddress(); 
    		from_address.setAddress(from);
    		message.setFrom(from_address); //Unhandled exception type MessagingException

    		InternetAddress to_address = new InternetAddress(); 
    		to_address = new InternetAddress(to); ////Unhandled exception type AddressException
    		System.out.println(Message.RecipientType.TO);
    	     message.addRecipient(Message.RecipientType.TO, to_address);  //Unhandled exception type MessagingException
    		message.setSubject("sending in a group");  //Unhandled exception type MessagingException
    		message.setText("Welcome to JavaMail");  //Unhandled exception type MessagingException
    		// alternately, to send HTML mail:
    		// message.setContent("<p>Welcome to JavaMail</p>", "text/html");
    		Transport transport = session.getTransport("smtp");  //Unhandled exception type NoSuchProviderException
    		transport.connect("smtp.mail.yahoo.co.in", "user name", "asdfgh");  //Unhandled exception type MessagingException
    		transport.sendMessage(message, message.getAllRecipients());  //Unhandled exception type MessagingException x2
    		transport.close();  //Unhandled exception type MessagingException