Tsohost Knowledge Base

How to send mail from scripts

Modified Wednesday 5th November, 2014 at 01:50

Was this helpful?

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 SSL on 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.


Still can't find what you're looking for?

That's not a problem. Our 24/7 customer support team are friendly and waiting to help answer your questions. The easiest way to get in touch is to raise a support ticket; simply click the button below.

Open Support Ticket