Error when send mail in java using javamail? -


i want use javamail test code

public class test_mail { public static void main(string [] args)  {      string to="xyz@gmail.com";//change accordingly    //get session object   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 = session.getdefaultinstance(props,   new javax.mail.authenticator() {   protected passwordauthentication getpasswordauthentication() {   return new passwordauthentication("abc@gmail.com","*****");    }   });    //compose message   try {   mimemessage message = new mimemessage(session);   message.setfrom(new internetaddress("abc@gmail.com"));//change accordingly   message.addrecipient(message.recipienttype.to,new internetaddress(to));   message.setsubject("hello");   message.settext("testing.......");    //send message   transport.send(message);    system.out.println("message sent successfully");    } catch (messagingexception e) {throw new runtimeexception(e);}    }   } 

but have error:

exception in thread "main" java.lang.runtimeexception: javax.mail.authenticationfailedexception: 534-5.7.14 please log in via web browser , 534-5.7.14 try again. 534-5.7.14 learn more @ 534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 gj16sm129363wic.24 - gsmtp

i tried many changes it's same error.

because google such large target spam have policies , practices in place try , prevent spam possible. appears account may have been flagged 1 of these policies , requires manual intervention working again.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -