0

play frsamework 1.2.5 を介して、ユーザーがフォームに入力した値 (つまり、名前、電子メール、およびメッセージ) を専用の電子メール受信ボックスに転送するにはどうすればよいですか?

4

1 に答える 1

0

import play.libs.Mail and try this: (this is for 1.2.4, but it should work)

SimpleEmail email = new SimpleEmail();
email.setFrom("sender@zenexity.fr");
email.addTo("recipient@zenexity.fr");
email.setSubject("subject");
email.setMsg("Message");
Mail.send(email); 

By default, in DEV mode, the e-mail will be printed to the console, while in PROD mode it will be sent to the actual SMTP server. You can change the default behaviour in DEV mode by commenting the following line:

# Default is to use a mock Mailer
mail.smtp=mock

here is the SMTP Configuration:

mail.smtp.host=smtp.gmail.com
mail.smtp.user=yourGmailLogin
mail.smtp.pass=yourGmailPassword
mail.smtp.channel=ssl

which should reside in application.conf, If i remember right

于 2013-09-09T13:31:43.293 に答える