Initial commit
This commit is contained in:
38
pages/email_autoconfig.go
Normal file
38
pages/email_autoconfig.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package pages
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type EmailAutoconfigTemplateData struct {
|
||||
Domain string
|
||||
DisplayName string
|
||||
ShortDisplayName string
|
||||
ImapServer string
|
||||
PopServer string
|
||||
SmtpServer string
|
||||
}
|
||||
|
||||
func emailAutoconfig(w http.ResponseWriter, r *http.Request) {
|
||||
templateFile := "templates/email_autoconfig.tmpl"
|
||||
files, err := template.New(templateFile).ParseFS(content, templateFile)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
err = files.ExecuteTemplate(w, "email_autoconfig.tmpl", EmailAutoconfigTemplateData{
|
||||
Domain: "prettysunflower.moe",
|
||||
DisplayName: "prettysunflower's mail server",
|
||||
ShortDisplayName: "prettysunflower",
|
||||
ImapServer: "mail.prettysunflower.moe",
|
||||
PopServer: "mail.prettysunflower.moe",
|
||||
SmtpServer: "mail.prettysunflower.moe",
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user