1
Possible Duplicate:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 25;javax.mail.MessagingException : 나는 JSP 페이지를 통해 이메일을 보내려고
SMTP 호스트에 연결하지만, 다음과 같은 오류 표시 할 수 없습니다 : 이것은 '코드입니다
javax.mail.MessagingException
: Could not connect to SMTP host: www.gmail.com, port: 25, response: 421
을 전자 메일을 보낼 때 사용 :
<%
try
{
String host = "www.gmail.com";
String to = request.getParameter("to");
String from = request.getParameter("from");
String subject = request.getParameter("subject");
String messageText = request.getParameter("body");
boolean sessionDebug = false;
Properties props = System.getProperties();
props.put("mail.host", host);
props.put("mail.transport.protocol", "smtp");
Session mailSession = Session.getDefaultInstance(props, null);
mailSession.setDebug(sessionDebug);
Message msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
msg.setSentDate(new Date());
msg.setText(messageText);
Transport.send(msg);
out.println("Mail was sent to " + to);
out.println(" from " + from);
out.println(" using host " + host + ".");
}
catch (MessagingException mex)
{
System.out.println("Error: unable to send message....");
mex.printStackTrace();
}
%>
누군가이 오류의 원인을 말해 줄 수 있습니까?
...port = "25"
의 [IETF을 인용 - RFC 2821] (HTTP : // datatracker. ietf.org/doc/rfc2821/) :'421 :