나는 응용 프로그램을 사용하여 gae 엔진 자바 메일 API를 코딩했습니다.GAE - 앱을 배포 할 때 작동하지 않지만 localhost에서 제대로 작동합니까?
내에서 appengine-web.xml의 :
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>mailapps</application>
<version>1</version>
<!--
Allows App Engine to send multiple requests to one instance in parallel:
-->
<threadsafe>true</threadsafe>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
<!--
HTTP Sessions are disabled by default. To enable HTTP sessions specify:
<sessions-enabled>true</sessions-enabled>
It's possible to reduce request latency by configuring your application to
asynchronously write HTTP session data to the datastore:
<async-session-persistence enabled="true" />
With this feature enabled, there is a very small chance your app will see
stale session data. For details, see
http://code.google.com/appengine/docs/java/config/appconfig.html#Enabling_Sessions
-->
</appengine-web-app>
내가 로컬 호스트에있는 응용 프로그램을 실행했을 때 나는 모든 것이 잘 작동하지만 실행할 때 GAE에 배포 내가 얻을 실행 :
Error: Server Error The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this error message and the query that caused it.
내 앱이 뭐가 잘못 되었나요? 저를 도와주세요?
1.UPDATE_
GAE 로그 말 : 서블릿 그게 전부
java.lang.RuntimeException: javax.mail.SendFailedException: Send failure (javax.mail.MessagingException: Illegal Arguments (java.lang.IllegalArgumentException: Unauthorized Sender: Unauthorized sender))
2.UPDATE
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Logger;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@SuppressWarnings("serial")
public class FeedbackServlet extends HttpServlet {
private static final Logger log = Logger.getLogger(FeedbackServlet.class.getName());
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String name = req.getParameter("name");
String description = req.getParameter("description");
String email = req.getParameter("email");
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
log.info(description + name + email + " :Daten extrahiert!");
String msgBody = name + " :Name der Person" + "\n" + description + " :Beschreibung der Person" + "\n" + email + " :EMAIL";
try {
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("[email protected]",
"It works"));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]", "Your name"));
msg.setSubject("Bestellung");
msg.setText(msgBody);
log.info("Message send!");
Transport.send(msg);
} catch (Exception e) {
resp.setContentType("text/plain");
resp.getWriter().println("Something went wrong. Please try again.");
throw new RuntimeException(e);
}
resp.setContentType("text/plain");
resp.getWriter().println(
"Thanks you for your feedback. An Email has been send out.");
}
}
!
GAE 대시 보드에서 GAE 로그를 열고 오류에 대한 유용한 정보가 있는지 확인하십시오. – sinelaw
: java.lang.RuntimeException : javax.mail.SendFailedException : 보내기 실패 (javax.mail.MessagingExce ption : 잘못된 인수 (java.lang.IllegalArgumentException : Unauthorized Sender : Unauthorized Sender) – maximus
응용 프로그램의 JavaMail 부분을 게시해야합니다. – iNan