package inquiry import ( "fmt" "strings" "time" ) // EmailTemplateData represents the data needed for the email template type EmailTemplateData struct { FullName string CompanyName string WorkEmail string PhoneNumber string InquiryID string CreatedAt int64 CompanyLogo string CompanyURL string SupportEmail string } // GenerateNewInquiryEmailTemplate generates a beautiful HTML email template for new inquiry notifications func GenerateNewInquiryEmailTemplate(data *EmailTemplateData) string { // Format the creation date createdAt := time.Unix(data.CreatedAt, 0).Format("January 2, 2006 at 3:04 PM") html := ` New Inquiry Request - {{COMPANY_NAME}}

New Inquiry Received

A new inquiry has been submitted to the opplens system

Identifier: {{INQUIRY_ID}}
Full Name
{{FULL_NAME}}
Company Name
{{COMPANY_NAME}}
Work Email
{{WORK_EMAIL}}
Phone Number
{{PHONE_NUMBER}}
Submitted on: {{CREATED_AT}}

This email was automatically sent from the Opplens System

` // Replace placeholders with actual data html = strings.ReplaceAll(html, "{{COMPANY_NAME}}", data.CompanyName) html = strings.ReplaceAll(html, "{{INQUIRY_ID}}", data.InquiryID) html = strings.ReplaceAll(html, "{{FULL_NAME}}", data.FullName) html = strings.ReplaceAll(html, "{{WORK_EMAIL}}", data.WorkEmail) html = strings.ReplaceAll(html, "{{PHONE_NUMBER}}", data.PhoneNumber) html = strings.ReplaceAll(html, "{{CREATED_AT}}", createdAt) return html } // GenerateNewInquiryEmailMessage generates a simple text message for the email func GenerateNewInquiryEmailMessage(data *EmailTemplateData) string { createdAt := time.Unix(data.CreatedAt, 0).Format("January 2, 2006 at 3:04 PM") return fmt.Sprintf(` New Inquiry Received Inquiry ID: %s Full Name: %s Company Name: %s Work Email: %s Phone Number: %s Submitted on: %s Please check the admin panel for more details. `, data.InquiryID, data.FullName, data.CompanyName, data.WorkEmail, data.PhoneNumber, createdAt, ) }