我正在使用播放邮件程序(https://github.com/playframework/play-mailer)从我的应用程序向一组人发送电子邮件,但我不希望收件人可以看到其他收件人的地址(在“收件人”字段中)我发现bcc可以解决这个问题,我试过这个但是没有用:
value addBcc is not a member of play.api.libs.mailer.Email
Read from stdout: possible cause: maybe a semicolon is missing before `value addBcc'?
我收到错误:
.next,.prev{
display: none !important;
}
答案 0 :(得分:0)
你走了:
包裹控制器
import play.api.libs.mailer._
import java.io.File
import org.apache.commons.mail.EmailAttachment
import javax.inject.Inject
import play.api._
import play.api.mvc._
import scala.concurrent.Future
import play.api.libs.json._
class MailerApi @Inject() (mailerClient: MailerClient) extends Controller {
def sendEmail = Action.async(parse.json) { request =>
val subject: String = (request.body \ "subject").as[String]
val cid = "1234"
val email = Email(
subject,
"ExcelWay <email1@gmail.com>",
Seq("Miss TO email2@gmail.com"),
// adds attachment
attachments = Seq(),
// sends text, HTML or both...
bodyText = Some("A text message"),
bodyHtml = Some("content"),
bcc= Seq("bccemail@example.com")
)
mailerClient.send(email)
Future.successful(Ok("ok !!"))
}
}