Sending mail from your website(s) is very easy with us! Simply set your sites SMTP server to one of the below SMTP servers and that is all! We’ve disabled our primary mail server systems from accepting mail from our web servers, these mail servers are dedicated for website email and allow us to better control website email.
The following server hosts are available to send mail for our web servers and other ASPnix-hosted systems
- mailer.anaxanet.com (no authentication required)
The following ports are available for SMTP connections
Note that the PHP mail method / function is not available on our servers, it has been disabled for security purposes. We recommend though that you do not use the built in PHP mail delivery method as it is unreliable and emails sent through this method are known to be flagged as spam, please use a direct SMTP mailer such as PHPMailer or Swift Mailer.
These SMTP servers will only send mail for servers within our web hosting network, you will not be able to send mail from an external host, a local development machine, or any 3rd party email clients such as Outlook.
Below are some code samples of various languages to get you started!
ASP.Net (C#)
1
2
3
4
5
6
7
|
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("MAILER_SERVER_ADDRESS");
mail.From = new MailAddress("from@yourdomain");
mail.To.Add("to@theirdomain");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail";
SmtpServer.Send(mail);
|
ASP.Net (VB)
1
2
3
4
5
6
7
8
|
Dim SmtpServer As New SmtpClient("MAILER_SERVER_ADDRESS")
Dim mail As New MailMessage()
mail = New MailMessage()
mail.From = New MailAddress("from@yourdomain")
mail.To.Add("to@yourdomain")
mail.Subject = "Test Mail"
mail.Body = "This is for testing SMTP mail"
SmtpServer.Send(mail)
|
Classic ASP (CDOSYS)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<%
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "MAILER_SERVER_ADDRESS"
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Update
ObjSendMail.To = "to@theirdomain"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = "from@yourdomain"
ObjSendMail.TextBody = "this is the body"
ObjSendMail.Send
Set ObjSendMail = Nothing
%>
|
Classic ASP using Persits Mailer
Please note that Persits requires 32-bit application pools, make sure this has been set for your website.
1
2
3
4
5
6
7
8
9
10
11
12
|
<%
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "MAILER_SERVER_ADDRESS"
Mail.Port = 25
Mail.From = "from@yourdomain"
Mail.FromName = "Your Name" ' Optional
Mail.AddAddress "to@theirdomain", "Their Name"
Mail.Subject = "Message Subject"
Mail.Body = "This is a message sent through Persits Mailer"
Mail.Send
Set Mail = Nothing
%>
|
PHP using PHPMailer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->Host = 'MAILER_SERVER_ADDRESS';
$mail->Port = 25;
$mail->setFrom('from@yourdomain', 'Your Name');
$mail->addAddress('to@theirdomain', 'Their Name');
$mail->Subject = 'First PHPMailer Message';
$mail->Body = 'Hi! This is my first e-mail sent through PHPMailer.';
if(!$mail->send())
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent.';
}
|
PHP using SwiftMailer
1
2
3
4
5
6
7
8
|
<?php
$transport = new Swift_SmtpTransport('MAILER_SERVER_ADDRESS', 25);
$mailer = new Swift_Mailer($transport);
$message = (new Swift_Message('SwiftMailer Subject'))
->setFrom(['from@yourdomain' => 'Your Name'])
->setTo(['to@theirdomain' => 'Their Name'])
->setBody('Here is the message itself');
$result = $mailer->send($message);
|