The sendmail request allows to send arbitrary e-mails using the server's sendmail
program.
Since this is effectively an open e-mail gateway, this must only be used in places where the end user can be identified. For anonymous contact forms, use submit requests.
To send emails, you need to install a mail transfer agent (MTA) such as OpenSMTPD:
sudo apt install opensmtpd
Other supported MTAs are postfix and nullmailer.
You may also need to set up SPF/DKIM records for the envelope (Return-Path: ...
) and sender (From: ...
) addresses.
To use sendmail, an account must have the sendmail
flag:
Every end user should be given a separate account to track abuse.
Using Backend.js, a mail can be sent as follows:
const backend = new Backend('https://viereck.ch/backend'); const account = backend.account('your-account-id', '44705748... your-account-key'); const mail = `From: ali@some-domain.com To: oskar@some-domain.com Subject: Hello This is a test email.`; account.sendmail(mail, onDone, onError); function onDone(request) { ... } function onError(errorCode, request) { ... }
200
if the mail was sent
400
if the request was invalid
401
if the account ID or signature is missing or invalid
403
if the account is not allowed to use SVG to PDF
MAIL must be a properly encoded MIME message.