Tsohost Help Centre

Table of Contents

How to send mail from scripts

Updated Oct 31st, 2017 at 11:37 GMT

You'll often want to send emails through a script. The two main methods are using SMTP or Sendmail:

SMTP (Recommended): Usually the better option when sending emails as it goes through a dedicated local relay server, meaning there's less chance of it being rejected by the receiving server. To use SMTP your script will need to connect to the server without SSLon port 25 with no authentication. This IP will only work in scripts run locally on the cloud.

Sendmail: Sendmail is a unix program used for sending mail. Mail sent with Sendmail is more heavily filtered than that sent by SMTP as it is very easy to send spoof emails using it. If you require it for you script however, the Sendmail binary is located at: /usr/bin/sendmail.