안녕하세요. 웹 로직 서버를 사용하여 이메일을 보내려고합니다. 자바 기본 파일 하나를 실행하여 이메일을 쉽게 보낼 수 있지만 웹 로직을 사용하여 보낼 수는 없습니다.weblogic에서 메일 보내기 10.3
Properties props = System.getProperties();
props.put("mail.smtp.user", SMTP_AUTH_USER);
props.put("mail.smtp.password", SMTP_AUTH_PWD);
props.setProperty("mail.transport.protocol", "smtp");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.imaps.ssl.trust", "*");
props.put("mail.smtp.ssl.trust", "smtp.gmail.com");
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "587");
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(SMTP_AUTH_USER, SMTP_AUTH_PWD);
}
});
System.out.println("Created session");
session.setDebug(true);
Transport transport = session.getTransport("smtp");
System.out.println("Got Transport from session");
MimeMessage message = new MimeMessage(session);
message.setSubject("Movies Store Ticket Confirmation");
message.setContent(" Dear Farish,\n \n Your Ticket Booking is Confirmed. Thank you for booking the ticket.\n \n " +
"Movie name : EndGame \n " +
"Theater Name : Mstore \n " +
"Screen : Screen A \n " +
"Selected Seat: B04 B05 \n " +
"Amount : 160 \n " +
"Show Date : 05/07/2014 \n " +
"Show Time : 10:00 AM ", "text/plain");
message.setFrom(new InternetAddress("******@gmail.com"));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress("********@gmail.com"));
System.out.println("Before Connecting");
transport.connect(SMTP_HOST_NAME,SMTP_AUTH_USER,SMTP_AUTH_PWD);
System.out.println("After Connecting");
transport.sendMessage(message,
message.getRecipients(Message.RecipientType.TO));
System.out.println("After Sensing");
transport.close();
}
사람이 나를 도와주세요 ... 사전에 감사합니다 ...
답장을 보내 주셔서 감사합니다. 나는 그걸 시도 할 것입니다 .. – FarishMohammed
나는 그걸 시도했습니다 ... 그게 작동하지 않는다면 ... 저에게도 같은 예외를주었습니다. – FarishMohammed