Sending emails out from ASP.NET

Discussion in 'Development' started by Arash, Nov 1, 2016.

Thread Status:
This thread is more than 60 days old.
  1. Arash

    Arash New Member

    Hi,

    Has anyone managed to get sending of emails out from your website on Interserver working with ASP.NET?

    I've tried System.Net.Mail.MailMessage and System.Web.Mail.MailMessage and neither work.
    I'm a .NET developer so I know my way round this topic and I have managed to get this to work on other hosters.

    Interserver's solution is the obsolete and outdated CDO.Message!!

    I'm pretty sure it's there internal SMTP configuration which is the issue but I wanted to check to see if anyone else has managed to get this to work.

    This is the code - more or less:

    SmtpClient smtpClient = new SmtpClient("216.158.229.34", 25);
    MailMessage mail = new MailMessage();
    //Setting From , To and CC
    mail.From = new MailAddress("info@mydomain.com");
    mail.To.Add(new MailAddress("info@mydomain.com"));
    mail.Body ="test";
    mail.Subject ="test";

    smtpClient.Credentials = new System.Net.NetworkCredential("info@mydomain.com", "PASSWORD");
    smtpClient.UseDefaultCredentials = false;
    smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
    smtpClient.EnableSsl = false;

    smtpClient.Send(mail);

    The support team have give me THREE different SMTP IPs that "SHOULD" work.

    Anyone?

    Thanks
     
  2. Quags

    Quags Administrator Staff Member

    Check the mx record for your domain name. It may be

    plesk-mail.interserver.net or plesk-mail2.interserver.net

    use this ip and not the server ip your site points to 216.158.229.34

    You can use port 25, 587 or 465 (ssl only on 465)
     
  3. Arash

    Arash New Member

    The mx record is mail.MYDOMAIN.com which resolves to 67.211.213.69.
    I've already tried this and on port 587 or 465, the process timeouts trying to connect to the smtp server.

    On port 25 it comes back with:
    "The remote certificate is invalid according to the validation procedure."

    With plesk-mail.interserver.net I get this:
    "Transaction failed. The server response was: 5.7.1 : Relay access denied"

    With plesk-mail2.interserver.net: Operation times out connecting to the smtp server

    The thing is, the same settings with 67.211.213.69 works if I try the code from my home PC which makes me think that my website just cannot connect to the smtp server!!

    It all points to a misconfiguration on Interserver side of things!
     
  4. Arash

    Arash New Member

    If I use 127.0.0.1 as smtp server, I get NO errors and everything seems to work but the email is not actually sent or received !
     
Thread Status:
This thread is more than 60 days old.

Share This Page