Send e-mails through our SMTP server
SMTP settings and a code sample for sending e-mails from your application.
Applications hosted with us can send e-mails — registration confirmations, password resets, contact forms. You have three options; pick the one that fits your plan and your domain.
| Option | Plan | Authentication | Best for |
|---|---|---|---|
| Local SMTP server of your website | Premium | None | The simplest setup on Premium |
| Your mailbox on our mail server | Premium with e-mail hosting | Mailbox login | Best deliverability, DKIM signing |
| External SMTP service (for example Gmail) | Free and Premium | Depends on the service | The Free plan |
Important
The local SMTP server is available on Premium plans only. On the Free plan use an external SMTP server — see Send e-mails through Gmail. The required outgoing ports are open.
Option 1: local SMTP server
The local SMTP server does not require authentication and listens on port 25.
| Setting | Value |
|---|---|
| SMTP server | The server name of your website, siteXXXX.siteasp.net |
| Port | 25 |
| Username / password | None |
| SSL | Off |
You find the server name in the Control Panel on the Overview page of your website, in the Server field.
using System.Net.Mail;
var mail = new MailMessage(
"sender@yourdomain.com", // from - use an address on your own domain
"recipient@example.com",
"Test e-mail",
"This is a test e-mail sent from my application.");
var smtp = new SmtpClient("siteXXXX.siteasp.net", 25);
smtp.EnableSsl = false;
smtp.Send(mail);
Send from an address on your own domain. It is not possible to send from an address on our domains (such as premiumasp.net), and messages from a non-existent mailbox are more likely to be treated as spam.
Add an SPF record
SPF tells other mail servers that our server is allowed to send e-mails for your domain. Without it your messages often end up in spam. Add this TXT record to the DNS of your domain:
| Name | Type | Value |
|---|---|---|
@ (or yourdomain.com) |
TXT | v=spf1 a:siteXXXX.siteasp.net ~all |
Note
DKIM signing through the local SMTP server works automatically only when your domain uses our name servers. If your DNS is hosted elsewhere (for example at Cloudflare), use Option 2.
Option 2: your mailbox on our mail server
If you have e-mail hosting for your domain, send through the mail server with the login of one of your mailboxes. Messages are then signed with DKIM, once DKIM is enabled for the domain.
| Setting | Value |
|---|---|
| SMTP server | Your mail server, mailXXX.mailasp.net (shown in the Control Panel under E-mails → your domain → Overview, in the Server field) |
| Port | 587 with STARTTLS (or 465 with SSL/TLS) |
| Username | The full e-mail address of the mailbox |
| Password | The password of the mailbox |
var smtp = new SmtpClient("mailXXX.mailasp.net", 587);
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("info@yourdomain.com", "mailbox-password");
Warning
Set UseDefaultCredentials = false before you assign Credentials. In the opposite order the credentials are cleared and the server rejects the message.
A mailbox can send up to 300 e-mails per hour; see E-mail service limits.
Protect your contact form
Never publish a contact form without protection. Bots fill in unprotected forms thousands of times, which sends spam from your domain and damages its reputation. Add a CAPTCHA such as Cloudflare Turnstile or Google reCAPTCHA to every public form.
E-mails are not arriving?
- Check the SPF record of your domain, and DKIM if you use it — see DNS records for e-mail.
- Make sure the sender address is on your own domain.
- Log the exception thrown by
Sendin your application; it contains the answer of the mail server. - If the SPF record is set and messages sent through the local SMTP server still end up in spam, open a support ticket from the Control Panel and we will generate a DKIM record for your domain.