diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 4a21a67..01d18f9 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -163,6 +163,23 @@ func (m *Repository) PostReservation(w http.ResponseWriter, r *http.Request) { return } + // send notifications - to gest + + htmlMessage := fmt.Sprintf(` + Reservation Confirmation + Dear %s,
+ This is confirm your reservation from %s to %s. + `, reservation.FirstName , reservation.StartDate.Format("2006-01-01"), reservation.EndDate.Format("2006-01-01")) + + msg := models.MailData{ + To: reservation.Email, + From: "test@server.com", + Subject: "Reservation Confirmation", + Content: htmlMessage, + } + + m.App.MailChan <- msg + m.App.Session.Put(r.Context(), "reservation", reservation) http.Redirect(w, r, "/reservation-summary", http.StatusSeeOther) } diff --git a/run.sh b/run.sh index 9ec859f..0b20102 100755 --- a/run.sh +++ b/run.sh @@ -12,3 +12,5 @@ go build -o bookings cmd/web/*.go && ./bookings # sudo service postgresql status # sudo -u postgres psql # install soda brew install gobuffalo/tap/pop +# 802 +# ~/go/bin/MailHog \ No newline at end of file