Oyunumdan e-posta göndermeye çalışıyorum. Şu anda localhost üzerinde uygulama çalıştırıyorum. E-posta bölümü için ben takip ediyordu bu https://github.com/playframework/play-mailer ve şimdiye kadar bu uygulamaya: Ben bağımlılıkları build.sbt bu ilave olmayacaklarını:Oyun içinden e-posta gönderemiyor mailer plugin
"com.typesafe.play" %% "play-mailer" % "5.0.0-M1"
Bu HomeController.Java geçerli: Bu Application.Config
//MAiler Inject
private final MailerClient mailer;
@Inject
public HomeController(MailerClient mailer)
{
this.mailer = mailer;
}
public void sendEmail() {
String cid = "1234";
Email email = new Email();
email.setSubject("Simple email");
email.setFrom("[email protected]");
email.addTo("[email protected]");
// adds attachment
// .addAttachment("attachment.pdf", new File("/some/path/attachment.pdf"))
// adds inline attachment from byte array
// .addAttachment("data.txt", "data".getBytes(), "text/plain", "Simple data", EmailAttachment.INLINE)
// adds cid attachment
// .addAttachment("image.jpg", new File("/some/path/image.jpg"), cid)
// sends text, HTML or both...
email .setBodyText("A text message");
// .setBodyHtml("<html><body><p>An <b>html</b> message with cid <img src=\"cid:" + cid + "\"></p></body></html>");
mailer.send(email);
}
olduğunu
play.mailer {
host="smtp.gmail.com"
port=465
ssl=yes
tls=no
user="[email protected]"
password="mypass"
debug=no
timeout=60
connectiontimeout=60
mock=no
}
İstisna:
[debug] application - DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
[debug] application -
[debug] application - DEBUG SMTP: need username and password for authentication
[debug] application -
[debug] application - DEBUG SMTP: useEhlo true, useAuth true
[debug] application -
[debug] application - DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false
[debug] application -
[error] application -
! @6pgje8o34 - Internal server error, for (POST) [/addUser] ->
play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[CompletionException: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:465]]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:269)
at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:195)
at play.api.GlobalSettings$class.onError(GlobalSettings.scala:160)
at play.api.DefaultGlobal$.onError(GlobalSettings.scala:188)
at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:98)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:99)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:98)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:344)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:343)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
Ancak, e-posta almıyorum.
Oyun oynuyorum 2.5.
burada bir çözüm bulundu. http://stackoverflow.com/questions/35974634/play-framework-mailer-throwing-nullpointerexception-at-maile-send-method artık istisna yok. Ama şimdi sorun e-posta almıyorum. –
sorumu güncelledi. Uygulama, application.config öğesinden SMTP ayarını almıyor gibi görünüyor ... herhangi biri yardım edebilir mi? –