Start a conversation

How do I send mail from my website using a script?

It is possible to use DNN4Less SMTP servers to send email from your web scripts. However to preserve the integrity of our networks, there are some limitations in place to avoid misuse.

You are responsible for the misuse of any scripts on your website.


Restrictions on Sending Mail from our Servers

To prevent spam from being sent through our webservers, there are certain restrictions in place when sending email from web scripts. These restrictions help us prevent spammers from using our servers and improves the service we can provide to you.

  • Email must be sent to, or from, an email address hosted by DNN4Less. This must be an existing mailbox in your account, and if your domain’s MX record points to another email provider, it will not count as being hosted by DNN4Less.

  • All outbound email must be routed through our outgoing email servers or it will not be delivered. It is not possible to send email from a script directly to a third party SMTP server.

  • We limit the number of emails you can send in any thirty second period and any ten minute period.

Outgoing mail servers

All mail scripts running on our webservers should use as the outgoing mail server. Please consult the documentation for your scripting language or component to find out how to set this correctly.

ASP Components

Your ASP code can use any of the following components:


Use the PHP mail function and set the ‘mail from’ value using the following code - replacing with the appropriate email address.

$email_from = “”;
ini_set("sendmail_from", “$email_from");

You need to add a fifth “-f” parameter to the sendmail function. This will set the name of the from address.

mail($email_to, $email_subject, $email_message, $headers, ‘-f’.$email_from);

Tips on securing your mail script

Form-to-mail scripts allow your visitors to fill out a form on your website, which will then email their input to you.

Such forms are regularly used by spammers, who hijack your script to send unsolicited email. Through a few simple checks, you can ensure that your form to mail script is only used by your website and sends to the email address you choose.


You can secure your form to mail scripts by checking the referrer string of the page calling your script, before processing it.

Choose files or drag and drop files
Was this article helpful?
  1. Senior Engineer Jessie

  2. Posted
  3. Updated