Create directory for your application:
mkdir -p mail cd mailCopied!

Create "mail-sender" application:
gg -k mail-sender
Copied!

Copy the following code to file "mail.golf":
begin-handler /mail public // Get URL parameter get-param action if-true action equal "show_form" // Display HTML 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 data from HTML form get-param from_mail get-param to_mail get-param message get-param subject_mail // Construct email message write-string msg @From: <<print-out from_mail>> @To: <<print-out to_mail>> @Subject: <<print-out subject_mail>> @ <<print-out message>> end-write-string // Send email exec-program "/usr/sbin/sendmail" args "-i", "-t" input msg status st // Check status of email sending 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-handlerCopied!

The example uses exec-program to invoke a MTA (Mail Transfer Agent), in this case postfix or sendmail, but you can use any other that you like!