mirror of
https://github.com/GRFreire/nthmail.git
synced 2026-01-09 21:09:39 +00:00
- Move mail functions to its own packages; - Move bigger router functions to its own functions, and separate router creation from main function; - Edit the algorithm that choses the format will be chosen with regards to format preference to a simples one.
39 lines
790 B
Plaintext
39 lines
790 B
Plaintext
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/GRFreire/nthmail/pkg/mail_utils"
|
|
)
|
|
|
|
templ inbox_body(rcpt_addr string, ms []mail_utils.Mail_obj) {
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<title>nthmail.xyz</title>
|
|
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
<meta name="description" content="A temporary mail service"/>
|
|
</head>
|
|
<body>
|
|
<h1>Emails for { rcpt_addr }:</h1>
|
|
<ul>
|
|
for _, m := range ms {
|
|
<li>
|
|
@mail_comp(m, rcpt_addr)
|
|
</li>
|
|
}
|
|
</ul>
|
|
</body>
|
|
</html>
|
|
}
|
|
|
|
templ mail_comp(m mail_utils.Mail_obj, rcpt_addr string) {
|
|
<a href={ templ.SafeURL(fmt.Sprintf("/%s/%d", rcpt_addr, m.Id)) }>
|
|
<div>
|
|
<p><b>{ m.Subject }</b></p>
|
|
<p>From { m.From }</p>
|
|
</div>
|
|
<p>{ m.Date }</p>
|
|
</a>
|
|
}
|