وهذا الكود الجديد public class MainActivity extends AppCompatActivity { private String editTextEmail; private String editTextSubject; private String editTextMessage; private Session session; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void po(View view){ Properties props = new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { //Authenticating the password protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("my email", "passs"); } }); try { //Creating MimeMessage object MimeMessage mm = new MimeMessage(session); //Setting