Billing Control Panel Client Voip ms sql webadmin ms sql backup mysql webadmin Server Status

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

    23 comments March 5th, 2012 5057

    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

    • ml01.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#)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    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
    16
    17
    18
    19
    20
    21
    
    <%
    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") = "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.HTMLBody = "this is the body"
    ObjSendMail.TextBody = "this is the body"
     
    ObjSendMail.Send
     
    Set ObjSendMail = Nothing 
    %>
    1 Star2 Stars3 Stars4 Stars5 Stars (6 votes, average: 5.00 out of 5)
    Loading...
  1. Please provide me an example of a full.

    Comment by Yousef on May 14th, 2012 at 1:20 AM



  2. 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.

    Comment by Christopher York Staff Member on May 14th, 2012 at 7:27 AM



  3. 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);

    Comment by Ken on May 29th, 2012 at 7:58 PM



  4. 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-

    Comment by Ken on May 29th, 2012 at 8:01 PM



  5. 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.

    Comment by Christopher York Staff Member on May 31st, 2012 at 1:18 PM



  6. Code samples are now provided for PHP, C#, VB.NET and Classic ASP.

    Comment by Christopher York Staff Member on October 16th, 2012 at 8:34 AM



  7. Is settings changed? its not working for 26 hours

    Comment by Mustafa Kemal KARABACAK on June 21st, 2013 at 10:09 AM



  8. 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.

    Comment by Christopher York Staff Member on June 21st, 2013 at 10:14 AM



  9. Hello,

    Dear Christopher York
    Settings made ​​all Web sites running.
    Thank you.

    Comment by M.kAYA on February 7th, 2014 at 11:32 AM



  10. 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.

    Comment by susan vinci-lucero on March 24th, 2014 at 4:11 PM



  11. @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.

    Comment by Christopher York Staff Member on March 24th, 2014 at 4:35 PM



  12. 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

    Comment by Tim Burnett on March 28th, 2015 at 12:27 PM



  13. Since Classic ASP is an old technology running on new technology platforms, check the control panel for your website and make sure it is set for 32-bit mode.

    Comment by Christopher York Staff Member on March 28th, 2015 at 12:33 PM



  14. Great, this works…. Thanks Christopher, still no idea why I can’t see errors

    Comment by Tim Burnett on April 3rd, 2015 at 12:10 PM



  15. 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

    Comment by Tim Burnett on April 3rd, 2015 at 12:10 PM



  16. 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!

    Comment by Eddie on June 11th, 2015 at 9:16 AM



  17. Are you trying to send mail within our network? If you are not within our network, our web mailer servers will respond with authentication required.

    Comment by Christopher York Staff Member on June 11th, 2015 at 10:29 AM



  18. 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

    Comment by Flavio Spezi on June 25th, 2015 at 4:37 AM



  19. You are using the wrong hostname… Use the hostname defined in the article above.

    Comment by Christopher York Staff Member on June 25th, 2015 at 5:31 PM



  20. 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);

    Comment by Ercan Erku on July 12th, 2015 at 11:25 AM



  21. @Ercan Erku – Please see the article above, you are using the wrong hostname.

    Comment by Christopher York Staff Member on July 12th, 2015 at 12:12 PM



  22. Christopher, please write right hostname? what is right hostname?

    Comment by Ercan Erku on July 13th, 2015 at 11:33 AM



  23. Please see the article above, it is provided.

    Comment by Christopher York Staff Member on July 13th, 2015 at 12:04 PM



Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>