Code Monkey home page Code Monkey logo

play-easymail's Introduction

Build Status play-easymail - an extension to the Typesafe mailer plugin for Play! Framework 2.x (Java)

This plugin uses concepts from Play20StartApp to make sending emails (text, html, mixed) easier. A sample is included.

Version information

play-easymail currently needs Play! Framework 2.x

play-easymail is cross-tested with Java 1.6, Java 1.7 (Up to 0.6.x) and Java 1.8 (from 0.7.0)

  • The master branch contains the code for Play! Framework 2.6.x (play-easymail version 0.9.0 and up).
  • The 2.5.x branch contains the code for 2.5.x (play-easymail version 0.8 - 0.8.x).
  • The 2.4.x branch contains the code for 2.4.x (play-easymail version 0.7 - 0.7.x).
  • The 2.3.x branch contains the code for 2.3.x (play-easymail version 0.6 - 0.6.x).
  • The 2.2.x branch contains the code for 2.2.x (play-easymail version 0.5 - 0.5.x).
  • The 2.1.x branch contains the code for 2.1.x (play-easymail version 0.2 - 0.3.x).
  • The 2.0.x is a maintenance branch for the 2.0.x series of Play! Framework (play-easymail version 0.1).

Features

Sending email through an easy-to-use API and allowing for text-only, html-only and mixed emails. Preferably based on Play! templates (see sample).

Code sample

Mailer.getDefaultMailer().sendMail(
    "Your subject",
    "Your text body",
    "[email protected]"
);

You can also have a look at the sample for a more advanced use-case (content from templates and setting custom headers).

Versions

  • 0.9.4 [2017-11-04]
    • new play mailer library
  • 0.9.3 [2017-07-12]
    • cross-release for Scala 2.11 and 2.12
  • 0.9.0 [2017-07-11]
    • Support for play 2.6.x (thanks @KadekM)
    • ATTENTION: This is for Play 2.6 - if you have Play 2.5, use a 0.8.x version.
  • 0.8.1 [2016-12-16]
    • Support for play 2.5.x (thanks @oexza)
    • ATTENTION: This is for Play 2.5 - if you have Play 2.4, use a 0.7.x version.
  • 0.7.0 [preview on 2015-06-09, release 2015-10-31]
    • Support for play 2.4.x (thanks @vmouta, @mkurz)
    • Use of new play-mailer-3.x (thanks @vmouta, @mkurz)
    • ATTENTION: This is for Play 2.4 - if you have Play 2.3 or older, use a 0.6.x version.
  • 0.6.6 [2014-10-28]
    • Fix delay setting location (thanks @mkurz)
    • Attachment support (thanks @mkurz)
  • 0.6.5 [2014-10-20]
    • Allow disabling X-Mailer header (thanks @mkurz)
    • Allow setting CC and BCC (thanks @mkurz)
  • 0.6.4 [2014-07-28]
    • Use Java 6 for releasing binaries (thanks @rui-ferreira)
  • 0.6.3 [2014-07-05]
    • Added setReplyTo method (thanks @cornelcroi)
  • 0.6.2 [2014-06-30]
    • Fix addCustomHeader method
    • Add sendMail convenience method for text-only mails
    • Add to sample: show advanced Mail example (add Reply-To header)
  • 0.6.1 [2014-06-29]
    • Add Scala 2.10.x binary to repository
    • Test against Scala 2.10.x
    • ATTENTION: Binaries are not published in ivy style any more, please update your resolver URLs (see #189)
  • 0.6.0 [2014-06-10]
    • Version for Play 2.3.x
  • 0.5.2 [2014-07-05]
    • Added setReplyTo method (thanks @cornelcroi)
    • Last version for Play 2.2.x
  • 0.5.1 [2014-07-01]
    • Backport fix for addCustomHeader method
  • 0.5 [2013-10-23]
    • First version for Play 2.2.x
  • 0.3 [2013-09-01]
    • A mail can now have custom headers (see issue #6) - thanks @jtammen
  • 0.2 [2013-02-06]
    • Version for 2.1.0
  • 0.1 [2012-07-09]
    • Initial release

License

Copyright (c) 2012-2017 Joscha Feth

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

play-easymail's People

Contributors

cornelcroi avatar dobau avatar eximius313 avatar gmsa avatar joscha avatar jtammen avatar kadekm avatar mkurz avatar oexza avatar rui-ferreira avatar sealskej avatar vmouta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

play-easymail's Issues

Repeatedly sending an email to an address

I am trying to troubleshoot an issue that has been occurring to a user on my site.

I am using play-easymail to send emails via AWS SES.

There isn't anything in the framework that would queue a request for an email and send it multiple times a day over a month? Even after application updates and restarts?

Just using:

private static void generateEmailReceipt(String subject, String content, String email) {
    final Body body = new Body(content);

    Mailer.getDefaultMailer().sendMail(subject, body,
            email);
}

Thanks

does'nt work in play 2.5.9 version 0.8.1

Hi,

i am using play authenticate conf ;

Mailer.getDefaultMailer().sendMail(
"Your subject",
"Your text body",
"[email protected]"
);

the class mailer have not method getDefaultMailer, just sendMail() method...

so i use your sample but with debug mode :

TODO: Disable this in production

mock=false
# SMTP server
# (mandatory)
# defaults to gmail
host=smtp.gmail.com

# SMTP port
# defaults to 25
port=587
#port=465

# Use TLS
# for GMail, this should be set to true
tls=true
#ssl=no
# isSSL=true

.....

i have this error :

Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 60000

with in debug :

DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 587, isSSL false

i tried tls=no, ssl=true port 465 but same problem

thanks in advance for help

Multiple email addresses

Hi,

Is there a way to send email to multiple addresses at once? See code below:

public static Result sendMail() {
    final Form<MailMe> filledForm = FORM.bindFromRequest();
    if (filledForm.hasErrors()) {
        return badRequest(index.render(filledForm));
    } else {
        final String email = "[email protected], [email protected]";

        final Body body = new Body(views.txt.email.body.render().toString(),
                views.html.email.body.render().toString());
        Mailer.getDefaultMailer().sendMail("play-easymail | it works!",
                body, email);

        flash("message", "Mail to '" + email
                + "' has been sent successfully!");
        return redirect(routes.Application.index());
    }
}

Thanks!

0.8.x on maven central

Hi.

could you please make your play-easymail version 0.8.x available on maven central?

Verify that mail was sent

Hello!

I was testing my application with my google account as smtp server... I noticed that when setting the account password blank, I don't receive any warning or error and, of course, the e-mail is not delivered. This is crucial for me since I'm storing the e-mails on a DB to be sent again if they were not sent (I keep an e-mail history).

Is there any possibility to verify if an e-mail was effectively sent? If there is, how?

Thanks for the help!

Can I change the sender for a single email?

Hello,

Is it possible with this plugin to change the sender of a single e-mail? The other mails on my project will be sent from the address I specified in my application.conf, but the contact e-mail should be sent from a different e-mail address.

Thanks

Remove play-easymail in the profile of the email

When I send an email using play-easymail, the email is sent to the email address I provide, but the email profile comes up as play-easymail.

Is there a way to remove this? I try using the custom headers to reset it, but this did not work?

[2_1] Compile Error

Since Scala upgrade in Play 2.1 build is not working anymore on 2_1 branch. I get

[error] /Users/seal/github/play-easymail/code/app/com/feth/play/module/mail/Mailer.java:219: error: no suitable method found for scheduleOnce(akka.util.FiniteDuration,Mailer.MailJob)
[error]                 .scheduleOnce(delay, new MailJob(email));
[error]                 ^
[error]     method Scheduler.scheduleOnce(scala.concurrent.duration.FiniteDuration,Function0<BoxedUnit>,ExecutionContext) is not applicable
[error]       (actual and formal argument lists differ in length)
[error]     method Scheduler.scheduleOnce(scala.concurrent.duration.FiniteDuration,ActorRef,Object,ExecutionContext) is not applicable
[error]       (actual and formal argument lists differ in length)
[error]     method Scheduler.scheduleOnce(scala.concurrent.duration.FiniteDuration,Runnable,ExecutionContext) is not applicable
[error]       (actual and formal argument lists differ in length)
[error] 1 error
[error] (compile:doc) javadoc returned nonzero exit code
[error] (compile:compile) javac returned nonzero exit code
[error] Total time: 5 s, completed Oct 30, 2012 6:49:46 PM

SMPT send mail not working

Hi
when i try to send mail
using below settings
port=587
auth=true
socketFactory.port=587
starttls.enable=true

user=${user}
username=${username}
password=${password}

getting exception

org.apache.commons.mail.EmailException: Sending the email to the following serve
r failed : pod51019.outlook.com:587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1242)
at org.apache.commons.mail.Email.send(Email.java:1267)
at com.typesafe.plugin.CommonsMailer.send(MailerPlugin.scala:241)
at com.typesafe.plugin.MailerBuilder$class.send(MailerPlugin.scala:194)
at com.typesafe.plugin.CommonsMailer.send(MailerPlugin.scala:215)
at util.Mailer$MailJob.run(Mailer.java:214)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:94)
at akka.jsr166y.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.jav
a:1381)
at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)
at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)
at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479)
at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
Caused by: javax.mail.MessagingException: [EOF]
at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1481)

    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1
  1. at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1054)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:634)
    at javax.mail.Transport.send0(Transport.java:189)
    at javax.mail.Transport.send(Transport.java:118)
    at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232)
    ... 11 more

let me know if there is any issue with my configuration.
or code would not support Encryption method: TLS

thank you
Rama.

Not sending emails

Hi, when I try to send email with your application, the body of the email just appears on my console, but I never receives the email. How can I fix this?

Broken release?

I was trying to incorporate 0.9.4 into my project, but sbt says:

[warn] ==== sonatype-releases: tried
[warn]   https://oss.sonatype.org/content/repositories/releases/com/feth/play-easymail_2.12/0.9.4/play-easymail_2.12-0.9.4.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.feth#play-easymail_2.12;0.9.4: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

[FeatureRequest] Provide "Threshold" property

So far, one can configure delay property which causes Easymail to send emails AFTER this delay.
In other words if we have a loop

for (int i = 0; i < 20; i++) {
    mailService.sendMail("[email protected]", "subject"+i", "body");
}

after the delay, Easymail will send 20 emails at once.

Unfortunately this can cause Reason 550 5.4.6 mail rate exceeded limit in some email providers.

It would be great if Easymail supports threshold property, so when we invoke our loop we will have such result:

sending email 0
[... delay ...]
sending email 1
[... delay ...]
sending email 2
[... delay ...]
and so on

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.