opendiffy / diffy

Other
1.25k stars 142 forks source link

Unable to email report #17

Closed kshitij10496 closed 5 years ago

kshitij10496 commented 5 years ago

I'm trying to export the report via the email extension provided by diffy. After reading all the documentation and most of the code, I could figure out that specifying notifications.targetEmail flag would automate an email from Diffy <diffy@no-reply.com>

Here is the docker command being used:

docker run --rm -d --name diffy-staging-clarisights \
  -ti -p 8880:8880 -p 8881:8881 -p 8888:8888 \
  diffy/diffy \
    -candidate=localhost:9000 \
    -master.primary=localhost:9001 \
    -master.secondary=localhost:9001 \
    -service.protocol=http \
    -serviceName="Production-Test" \
    -proxy.port=:8880 \
    -admin.port=:8881 \
    -http.port=:8888 \
    -rootUrl=localhost:8888 \
    -notifications.targetEmail="kshitij.saraogi@gmail.com" \
    -notifications.delay=10.minutes

Assuming that a SMTP service (namshi/smtp image) listening on localhost:25 accessible by the container. (I'm running both of them in a K8s pod). However, I'm not able the diffy is having issues sending the email. Is there a workaround to exporting data from diffy?

haihn168 commented 5 years ago

I change the configuration of smtp server in the code and it send well with Gmail smtp. And you can also use the api to get the report: /api/1/report

kshitij10496 commented 5 years ago

Hey @haihn168

Thanks for replying. Would it possible for you to share a sample of the changes you made to the SMTP server? I would be very grateful if you help me fix it.

haihn168 commented 5 years ago

Below is my code for gmail smtp, you should change it in EmailSender.scala and recompile the code. Don't forget to add the parameter email when starting the proxy:

`private[this] val props = new Properties props.put("mail.smtp.host", "smtp.gmail.com") props.put("mail.smtp.auth", "true") props.put("mail.smtp.port", "587") props.put("mail.smtp.starttls.enable", "true")

private[this] val session = Session.getDefaultInstance(props, new Authenticator() { override protected def getPasswordAuthentication = new PasswordAuthentication("$emailhere", "$password") } )`

meeraeldhose commented 2 years ago

@haihn168 @puneetkhanduri I am trying to do the same here. Because i have enabled the 2 factor authentication, I want to check what should be the app name when configuring on google account ?

haihn168 commented 2 years ago

@meeraeldhose I dropped this project 2 years ago. No idea now.