diff --git a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Email.kt b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Email.kt index e66788d..3c7261b 100644 --- a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Email.kt +++ b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Email.kt @@ -32,6 +32,7 @@ class Email { logger.debug("Constructing email") val email = EmailBuilder.startingBlank() .to("Simulator Team", environment.getProperty("smtp.toaddress")) + .from("noreply@obsdb") .withSubject("Observation Session Data") .withPlainText("Attached observation data was generated: ${DateTime.now()}.") .withAttachment("observations.csv", observationsToCSV(observations).toByteArray(), "text/csv") diff --git a/backend/src/main/resources/META-INF/spring-configuration-metadata.json b/backend/src/main/resources/META-INF/spring-configuration-metadata.json index 238310f..a4b7340 100644 --- a/backend/src/main/resources/META-INF/spring-configuration-metadata.json +++ b/backend/src/main/resources/META-INF/spring-configuration-metadata.json @@ -9,7 +9,7 @@ "type": "java.lang.Boolean" }, { - "name": "smtp.server", + "name": "smtp.host", "type": "java.lang.String" }, { diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index cdefd4b..21b1625 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -7,7 +7,7 @@ spring.cache.cache-names=observations,charts spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s management.endpoints.web.exposure.include=health,info,metrics smtp.enabled=false -smtp.server=x +smtp.host=x smtp.port=587 smtp.username=none smtp.password=none diff --git a/frontend/src/views/ViewObservations.vue b/frontend/src/views/ViewObservations.vue index 8af0fd3..fc8a75d 100644 --- a/frontend/src/views/ViewObservations.vue +++ b/frontend/src/views/ViewObservations.vue @@ -372,11 +372,20 @@ export default { this.startDate = moment().subtract(amount, timeType); }, sendEmail: function() { - Vue.axios.post("/observations/email").catch(error => { - this.errorStatus = error.response.status; - this.errorMessage = error.response.data; - this.$refs.errorModal.show(); - }); + Vue.axios + .post("/observations/email", { + site: this.$store.state.search.site, + tutor: this.$store.state.search.tutor, + startDate: moment(this.startDate).format("YYYY-MM-DD"), + endDate: moment(this.endDate).format("YYYY-MM-DD"), + whom: this.$store.state.search.whom, + person: this.$store.state.search.person + }) + .catch(error => { + this.errorStatus = error.response.status; + this.errorMessage = error.response.data; + this.$refs.errorModal.show(); + }); } } };