How do I send mail from my website on Windows shared services?

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

  • 25
  • 465 (SSL)
  • 587 (TLS)

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#)

MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("mailer.anaxanet.com");
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)

Dim SmtpServer As New SmtpClient("mailer.anaxanet.com")
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)

<%
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.anaxanet.com"
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.

<%
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "mailer.anaxanet.com"
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

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = 'mailer.anaxanet.com';
$mail->Port = 587;
$mail->SMTPAutoTLS = true;
$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

setFrom(['from@yourdomain' => 'Your Name'])
    ->setTo(['to@theirdomain' => 'Their Name'])
    ->setBody('Here is the message itself');
$result = $mailer->send($message);

25 thoughts on “How do I send mail from my website on Windows shared services?”

    • Thank you for your comment.

      I assume you mean a code samples. Unfortunately we do not provide any code samples, if you are looking for code samples I would recommend looking at the languages documentation / website for more help. Php.net has many complete samples and there are many websites dedicated to .NET.

  1. It’s pretty straight forward and simple in ASP.net using the SMTP server maillist.anaxanet.com. Set the from address and SMTP server in web.config and then instantiate SMPTClient in your code.

    In web.config, set SMTP settings:
    ———————————

    In code behind for web page (C#)
    ——————————————

    SmtpClient smtp = new SmtpClient();

    // Create message with your email and the send to email address

    MailMessage msg = new MailMessage(new System.Net.Mail.MailAddress("youremail@domain.com"), new System.Net.Mail.MailAddress("sendto@goober.net"));
    msg.Subject = "Confirmation Email";
    msg.Body = "Yada Yada Yada - message body";

    smtp.Send(msg);

  2. Web.config setting – with gt & lt removed from tags

    -system.net-
    -mailSettings-
    -smtp from=”fromaddress@yourdomain.com”-
    -network host=”MAILLIST_HOST_NAME” port=”25″ userName=”” password=”” /-
    -/smtp-
    -/mailSettings-
    -/system.net-

  3. Make sure you are not using just maillist.anaxanet.com.

    Use the one allocated for your account / location.

    ml01.anaxanet.com (USA)
    ml01-de.anaxanet.com (Germany)

    The maillist.anaxanet.com hostname may not work in the future.

  4. Hello,

    No these settings are still valid. The maillist servers are still correct, make sure though that your script is not supplying a username / password. This should not be set for these servers.

  5. Christopher, can you please elaborate on how to set-up the plug-in? Our web admin installed the plug-in but said he has no idea how to set it up based on this article. Any clarification is appreciated.

    • @Susan vinci-lucero – There is not much too it… Install it and use the SMTP host specified above for your data-center location. As the article states, no authentication is required.

  6. This doesn’t work at all, I just get an error 500…

    Dim ObjSendMail
    Set ObjSendMail = CreateObject(“CDO.Message”)

    ObjSendMail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 0
    ObjSendMail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = “ml01.anaxanet.com”
    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 = “toemailaddress”
    ObjSendMail.Subject = “this is the subject”
    ObjSendMail.From = “fromemailaddress”

    ObjSendMail.HTMLBody = “this is the body”
    ObjSendMail.TextBody = “this is the body”

    ObjSendMail.Send

    Set ObjSendMail = Nothing

  7. Set myMail=CreateObject(“CDO.Message”)
    myMail.Subject=”Sending email with CDO”
    myMail.From=”mymail@mydomain.com”
    myMail.To=”someone@somedomain.com”
    myMail.TextBody=”This is a message.”
    myMail.Configuration.Fields.Item _
    (“http://schemas.microsoft.com/cdo/configuration/sendusing”)=2
    ‘Name or IP of remote SMTP server
    myMail.Configuration.Fields.Item _
    (“http://schemas.microsoft.com/cdo/configuration/smtpserver”)=”smtp.server.com”
    ‘Server port
    myMail.Configuration.Fields.Item _
    (“http://schemas.microsoft.com/cdo/configuration/smtpserverport”)=25
    myMail.Configuration.Fields.Update
    myMail.Send
    set myMail=nothing

  8. I’m using this code in a Web API project, but \every time I try to send an email by calling the service method I get either this error when using port 587:

    “The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication required”

    or this error when using port 465 (with SSL enabled):

    “Client does not have permission to submit mail to this server. The server response was: 4.3.3 TLS not available: error generating SSL handle”

    Any idea why? I’m not passing in any authentication, as you’ve stated it’s not required, but these errors seem to indicate that it IS required…? Thanks for your help!

  9. I can’t send email from a website.
    It was works properly when the server was in Germany. Today the server is in USA, and it does not works anymore.
    I changed SMTP address from “ml01-de.anaxanet.com” to “mx01.anaxanet.com”, but this does not solve.

    I try SMTP service with this simplest code:

    using (var smtpClient = new System.Net.Mail.SmtpClient(“mx01.anaxanet.com”)) {
    var testAddress = “my@domain.com”;
    using (var message = new System.Net.Mail.MailMessage(testAddress, testAddress, “Test email”, “Trying to send a test email”)) {
    smtpClient.Send(message);
    }
    }

    I receive this error:
    A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 8.8.246.37:25

    Any idea?

    Thanks very much

  10. it’s not working Christopher. i get the unable to connect server. if i try in locally, it’s working. but, in web site, it s NOT WORKING….

    our code:

    MailMessage msgMail = new MailMessage();
    msgMail.To.Add(new MailAddress(“ercan@ercanerku.com”, “Ercan Erkü”));
    msgMail.From = new MailAddress(“ercan@ercanerku.com”);
    msgMail.Subject = “”;
    msgMail.Body = “denemedir.”;
    msgMail.IsBodyHtml = true;

    SmtpClient smtp = new SmtpClient(“mx01.anaxanet.com”, 587);
    smtp.EnableSsl = false;

    if (smtp_username.Length > 0)
    smtp.Credentials = new NetworkCredential(smtp_username, smtp_password);

    smtp.Send(msgMail);

  11. ml01.anaxanet.com is the same as mailer.anaxanet.com, they are one in the same. The mlxx naming scheme is older when we had multiple servers, but there is no need for multiples since we have multiple outgoing gateways that handle mail. Your app will continue working just fine on ml01.anaxanet.com.

Comments are closed.