begin-handler /mail public
get-param action
if-true action equal "show_form"
@<h2>Enter email and click Send to send it</h2>
@Note: 'From' field must be the email address from the domain of your server.<br/><br/>
@<form action="<<print-path "/mail">>" method="POST">
@ <input type="hidden" name="action" value="submit_form">
@ <label for="from_mail">From:</label><br>
@ <input type="text" name="from_mail" value=""><br>
@ <label for="to_mail">To:</label><br>
@ <input type="text" name="to_mail" value=""><br><br>
@ <label for="subject_mail">Subject:</label><br>
@ <input type="text" name="subject_mail" value=""><br><br>
@ <label for="message">Message:</label><br>
@ <textarea name="message" rows="3" columns="50"></textarea>
@ <br/><br/>
@ <input type="submit" value="Send">
@</form>
else-if action equal "submit_form"
get-param from_mail
get-param to_mail
get-param message
get-param subject_mail
write-string msg
@From: <<print-out from_mail>>
@To: <<print-out to_mail>>
@Subject: <<print-out subject_mail>>
@
<<print-out message>>
end-write-string
exec-program "/usr/sbin/sendmail" args "-i", "-t" input msg status st
if-true st not-equal GG_OKAY
@Could not send email!
else-if
@Email sent!
end-if
@<hr/>
else-if
@Unrecognized action!<hr/>
end-if
end-handler
Copied!