Sending email appears to work only in domain

Discussion in 'Email' started by Cliff, Oct 1, 2020.

  1. Hi,

    I am using the following code to generate and send an email:

            private SmtpClient GetSmtpClient()
                SmtpClient client = new SmtpClient();
                client.Host = Properties.Settings.Default.SmtpHost;
                client.UseDefaultCredentials = false;
                // [email protected]
                System.Net.NetworkCredential credential = new System.Net.NetworkCredential(Properties.Settings.Default.UserName, Properties.Settings.Default.Password);
                client.Credentials = credential;
                return client;
    Which gets used here ...
      MailMessage message = new MailMessage();
                    message.IsBodyHtml = true;
                    message.Body = GetSimpleNotificationTemplate(model);
                    message.From = new MailAddress("[email protected]");
                    message.To.Add(new MailAddress(model.Email)); 
                    message.Subject = "Confirmation";
                    var client = GetSmtpClient();
    Here is the problem. It only sends to accounts in the postmaster domain. For example, it will send to [email protected], but not to any other domains like hotmail or google. Not sure what's going on. Am I missing something in my mail setup? Any insight appreciated. Thank you
  2. Elshadriel

    Elshadriel Winhost Staff

    You might want to open up a support ticket so we can check the mail logs to see what might be happening. It's also difficult to troubleshoot since you're not using your domain name, and it might be DNS related. Your code on a cursory inspection looks fine.
  3. Good advice, I opened a new ticket, thank you

Share This Page