Я получаю 550 5.7.1 Невозможно передать для someUser@gmail.com
try {Properties p = System.getProperties ();
p.put("mail.smtp.host", "server IP");
p.put("mail.smtp.port", "25");
p.put("mail.debug", "true");
Session s = Session.getDefaultInstance(p);
Message msg = new MimeMessage(s);
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(subject);
Multipart mp = new MimeMultipart();
BodyPart bp = new MimeBodyPart();
bp.setText(message);
mp.addBodyPart(bp);
msg.setContent(mp);
Transport t = s.getTransport("smtp");
t.send(msg);
return 0;
} catch (Exception e) {
e.printStackTrace();
return 1;
}