added html admin notification mail
This commit is contained in:
@@ -19,6 +19,8 @@ type User struct {
|
|||||||
LastName string `gorm:"not null" json:"last_name"`
|
LastName string `gorm:"not null" json:"last_name"`
|
||||||
ProfilePicture string `json:"profile_picture"`
|
ProfilePicture string `json:"profile_picture"`
|
||||||
Address string `gorm:"not null" json:"address"`
|
Address string `gorm:"not null" json:"address"`
|
||||||
|
ZipCode string `gorm:"not null" json:"zip_code"`
|
||||||
|
City string `form:"not null" json:"city"`
|
||||||
Consents []Consent `gorm:"constraint:OnUpdate:CASCADE"`
|
Consents []Consent `gorm:"constraint:OnUpdate:CASCADE"`
|
||||||
BankAccount BankAccount `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
BankAccount BankAccount `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
||||||
Verification Verification `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
Verification Verification `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
||||||
|
|||||||
@@ -102,7 +102,42 @@ func (s *EmailService) SendWelcomeEmail(user *models.User, membership *models.Me
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *EmailService) NotifyAdminOfNewUser(user *models.User) error {
|
func (s *EmailService) NotifyAdminOfNewUser(user *models.User) error {
|
||||||
subject := "New User Registration"
|
// Prepare data to be injected into the template
|
||||||
body := "<p>A new user has registered with the email: " + user.Email + "</p>"
|
data := struct {
|
||||||
return s.SendEmail(s.adminEmail, subject, body)
|
FirstName string
|
||||||
|
LastName string
|
||||||
|
MembershipModel string
|
||||||
|
MembershipID int64
|
||||||
|
MembershipFee float32
|
||||||
|
RentalFee float32
|
||||||
|
Address string
|
||||||
|
ZipCode string
|
||||||
|
City string
|
||||||
|
DateOfBirth string
|
||||||
|
Email string
|
||||||
|
Phone string
|
||||||
|
IBAN string
|
||||||
|
}{
|
||||||
|
FirstName: user.FirstName,
|
||||||
|
LastName: user.LastName,
|
||||||
|
MembershipModel: user.Membership.SubscriptionModel.Name,
|
||||||
|
MembershipID: user.Membership.ID,
|
||||||
|
MembershipFee: float32(user.Membership.SubscriptionModel.MonthlyFee),
|
||||||
|
RentalFee: float32(user.Membership.SubscriptionModel.HourlyRate),
|
||||||
|
Address: user.Address,
|
||||||
|
ZipCode: user.ZipCode,
|
||||||
|
City: user.City,
|
||||||
|
DateOfBirth: user.DateOfBirth.Format("20060102"),
|
||||||
|
Email: user.Email,
|
||||||
|
Phone: *user.Phone,
|
||||||
|
IBAN: user.BankAccount.IBAN,
|
||||||
|
}
|
||||||
|
|
||||||
|
subject := "Neues Mitglied hat sich registriert"
|
||||||
|
body, err := ParseTemplate("mail_registration.html", data)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error.Print("Couldn't send admin notification mail")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return s.SendEmail(user.Email, subject, body)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,12 +71,13 @@
|
|||||||
<li>
|
<li>
|
||||||
<strong>Das gebuchtes Modell</strong>:
|
<strong>Das gebuchtes Modell</strong>:
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>Name</strong>: {{.Modellname}}</li>
|
<li><strong>Name</strong>: {{.MembershipModel}}</li>
|
||||||
<li><strong>Preis/Monat</strong>: {{.PreisMonat}}</li>
|
<li><strong>Preis/Monat</strong>: {{.MembershipFee}}</li>
|
||||||
<li><strong>Preis/h</strong>: {{.PreisStunde}}</li>
|
<li><strong>Preis/h</strong>: {{.RentalFee}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><strong>Name:</strong> {{.FirstName}} {{.LastName}}</li>
|
<li><strong>Name:</strong> {{.FirstName}} {{.LastName}}</li>
|
||||||
|
<li><strong>Mitgliedsname:</strong> {{.MembershipID}}</li>
|
||||||
<li>
|
<li>
|
||||||
<strong>Adresse:</strong> {{.Address}},{{.ZipCode}}
|
<strong>Adresse:</strong> {{.Address}},{{.ZipCode}}
|
||||||
{{.City}}
|
{{.City}}
|
||||||
|
|||||||
Reference in New Issue
Block a user