Skip to content

Commit

Permalink
Comments + minor HTML change
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasTJdev committed Feb 2, 2025
1 parent 0c889c7 commit 5919469
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/email/email_connection.nim
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,19 @@ proc sendMailMimeNow*(
# Add first part to message
multi.parts.add(first)

when defined(dev) and not defined(forcemail):
when defined(dev):
echo "\n"
echo "##################"
echo "Email to: " & recipient
echo "Subject: " & subject
echo "Message: " & message
echo "##################"
echo "\n"
return (true, "dev" & $rand(100000), 1)
when not defined(forcemail):
return (true, "dev" & $rand(100000), 1)

if smtpData.smtpHost == "smtp_host":
echo "SMTP not configured"
return (false, "SMTP_not_configured_" & $rand(100000), 1)

# Make SMTP connection
Expand All @@ -147,8 +149,13 @@ proc sendMailMimeNow*(
messageID: string

try:
smtpAuth(client, smtpData.smtpHost, smtpData.smtpPort, smtpData.smtpUser, smtpData.smtpPass)
client.connect(smtpData.smtpHost, Port(smtpData.smtpPort.parseInt()))
client.auth(smtpData.smtpUser, smtpData.smtpPass)
(success, messageID) = sendMail(client, smtpData.smtpFromEmail, recipient, multi)

when defined(dev):
echo "Message sent: " & $success
echo "Message ID: " & messageID
except:
echo getCurrentExceptionMsg()
success = false
Expand Down
2 changes: 1 addition & 1 deletion src/html/optin.nimf
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
# end if
# if signupForm:
<form action="/subscribe/${listUUID}" method="post" class="center">
<input type="email" name="email" placeholder="Email" required>
<input type="text" name="name" placeholder="Name">
<input type="email" name="email" placeholder="Email" required>
<input type="text" name="username_second" placeholder="Name" class="hideme">
<div class="buttonArea">
<button type="submit" class="buttonIcon">
Expand Down

0 comments on commit 5919469

Please sign in to comment.