Click here to Skip to main content
       

Java

 
AnswerRe: Regarding Maven and Jenkins PinmvpRichard MacCutchan3-Jan-13 0:12 
GeneralRe: Regarding Maven and Jenkins PinmembersivaKrishna joga3-Jan-13 0:23 
GeneralRe: Regarding Maven and Jenkins PinmvpRichard MacCutchan3-Jan-13 1:06 
GeneralRe: Regarding Maven and Jenkins PinmembersivaKrishna joga3-Jan-13 1:13 
GeneralRe: Regarding Maven and Jenkins PinmvpRichard MacCutchan3-Jan-13 1:58 
GeneralRe: Regarding Maven and Jenkins PinmembersivaKrishna joga3-Jan-13 2:16 
AnswerRe: Regarding Maven and Jenkins [modified] PinmemberApril Fans3-Jan-13 15:39 
Questionjava TLS Sending Email Pinmemberrenishkhunt2-Jan-13 18:52 
import javax.mail.*;
import javax.mail.Message;
import java.util.*;
import javax.mail.internet.*;
 
public class Sendemail {
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
            final String username="username";
            final String password="password";
            Properties prop=new Properties();
            prop.put("mail.smtp.auth", "true");
            prop.put("mail.smtp.host", "smtp.gmail.com");
            prop.put("mail.smtp.port", "587");
            prop.put("mail.smtp.starttls.enable", "true");
        
            Session session = Session.getDefaultInstance(prop,
		  new javax.mail.Authenticator() {
			protected PasswordAuthentication getPasswordAuthentication() {
				return new PasswordAuthentication(username, password);
			}
		  });
          try {
 
			Message message = new MimeMessage(session);
			message.setFrom(new InternetAddress("myemail@gmail.com"));
			message.setRecipients(Message.RecipientType.TO,
				InternetAddress.parse("receiveremail@gmail.com"));
			message.setSubject("Testing Subject");
			message.setText("Dear Mail Crawler,sNo spam to my email, please!");
                       
			Transport.send(message);
 
			System.out.println("Done");
 
		} catch (MessagingException e) {
			e.printStackTrace();
		}
            
    }
}
 

 

Please Help Someone..
    I have Exception On this code
 
javax.mail.MessagingException: 502 5.5.1 Unrecognized command. nw9sm29708787pbb.42
 
	at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:2080)
	at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1910)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:652)
	at javax.mail.Service.connect(Service.java:317)
	at javax.mail.Service.connect(Service.java:176)
	at javax.mail.Service.connect(Service.java:125)
	at javax.mail.Transport.send0(Transport.java:194)
	at javax.mail.Transport.send(Transport.java:124)
	at sendemail.Sendemail.main(Sendemail.java:44)
 


AnswerRe: java TLS Sending Email PinmemberPhat (Phillip) H. VU2-Jan-13 22:08 
GeneralRe: java TLS Sending Email Pinmemberrenishkhunt2-Jan-13 23:26 
GeneralRe: java TLS Sending Email [modified] PinmemberPhat (Phillip) H. VU3-Jan-13 0:12 
GeneralRe: java TLS Sending Email PinmemberPhat (Phillip) H. VU3-Jan-13 20:09 
QuestionGeneric BST helpp!! PinmemberyanikaA2-Jan-13 4:23 
QuestionJSF Pinmemberrkpandey201331-Dec-12 0:20 
AnswerRe: JSF PinmvpRichard MacCutchan31-Dec-12 0:54 
AnswerRe: JSF PinmvpRichard MacCutchan7-Jan-13 6:31 
QuestionJSF with Tiles Pinmembergurpreetsingh201531-Dec-12 0:12 
AnswerRe: JSF with Tiles Pinmemberrkpandey201331-Dec-12 0:21 
AnswerRe: JSF with Tiles PinmvpRichard MacCutchan31-Dec-12 0:54 
QuestionAnnotation PingroupVijay Kumar Jaiswal30-Dec-12 18:20 
AnswerRe: Annotation PinmemberTorstenH.30-Dec-12 21:35 
AnswerRe: Annotation PinmemberPhat (Phillip) H. VU2-Jan-13 22:14 
AnswerRe: Annotation [modified] PinmemberApril Fans3-Jan-13 15:44 
AnswerRe: Annotation Pinmembermuthu shankar7-Jan-13 4:30 
AnswerRe: Annotation [modified] PinmemberApril Fans16-Jan-13 21:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 31 Aug 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid