playframework / play-plugins

CachePlugin
444 stars 161 forks source link

Mailer: cannot add Header #128

Closed cristiboariu closed 10 years ago

cristiboariu commented 10 years ago

I have tried to add custom header using this Mailer plugin but they are not set. If I go and use apache commons mail it works. Can you please recheck addHeader method for issues? This header is not set for instance (and any custom one):

mail.addHeader("X-Priority", "1");
mkurz commented 10 years ago

I can not reproduce your problem, addHeader works fine for me. Make sure you really look into the raw e-mail source.

I used following code for testing:

MailerAPI mail = play.Play.application().plugin(MailerPlugin.class).email();
mail.setSubject("Test E-mail");
mail.setRecipient("Bill Gates <noreply@email.com>", "example@foo.com");
mail.setFrom("noreply@email.com");
mail.addHeader("X-Priority", "1");
mail.sendHtml("<html>html</html>");

The above code sets the "X-Priority" header just fine.

askell commented 9 years ago

Issue reproducible on version 2.1.0 Is there any fix for it? We are using securesocial 2.1.1 which references to this version of mailer, so we unable to use other version

mkurz commented 9 years ago

@askell I think you can explicitly define the latest play-plugins-mailer in your build.sbt file and it will be used - even when the module you use (in your case securesocial) includes an older version. The older version will just be overriden with the newer one you define. (At least that's what I think)

libraryDependencies ++= Seq(
  "com.typesafe.play.plugins" %% "play-plugins-mailer" % "2.3.1"
)