Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwrite sender's mail id which is set in application.conf #144

Open
suribabu39 opened this issue Jun 12, 2018 · 4 comments
Open

Overwrite sender's mail id which is set in application.conf #144

suribabu39 opened this issue Jun 12, 2018 · 4 comments

Comments

@suribabu39
Copy link

suribabu39 commented Jun 12, 2018

Hi, I have set required configurations in application.conf as below:

play.mailer {
  host=smtp.gmail.com
  port=465
  ssl=true
  tls=false
  user="[email protected]"
  password = "****"
  debug=true
  mock=false
}

While sending some emails I need to override default sender's mail id(which was set in application.conf), it is still sending email from "[email protected]" rather than sending from "[email protected]".

mailerClient().send(Email("Simple email", "[email protected]",Seq("[email protected]")))

Is there any way to overwrite the default sender email id?

@ggrossetie
Copy link
Member

As far as I remember, the email address configured in the application.conf will be used for the authentication. If you want to use another account you will need to manually instantiate another SMTPMailer: https://github.com/playframework/play-mailer#multiple-smtpmailer-instances

Does it make sense ?

@Christophenkoa
Copy link

HI , then there is no way to dynamically used several sender's email id? How should i do if i want to create a blog and receive all feedbacks of my visitors through my email(in this case each visitor is a sender). I am a beginner in play. Thank for your help and sorry for my english

@ggrossetie
Copy link
Member

Hi @Christophenkoa
I don't think you should "impersonate" each visitor by sending an email from their email address. I believe, it's a bad practice to send an email from an arbitrary email address.
Instead you should send an email with your email address (or a bot account email address) and add the email address of your visitor in the body/title of your email.

The user/from address is really for authentication purpose with the SMTP server to make sure that when you receive an email from [email protected] it was really sent by [email protected].

At least that's my understanding 😉

@Christophenkoa
Copy link

Thanks a lot!
My mentor told me the same thing.
It makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants