problem in sending email via SMTP service not as external senders
Asked Answered
B

1

2

I have a problem in sending email to one of my office distributed group. The issue is as below:

Remote Server returned '550 5.7.133 RESOLVER.RST.SenderNotAuthenticatedForGroup; authentication required; Delivery restriction check failed because the sender was not authenticated when sending to this group'

By reading this blog (Link) and a few other posts, I understand in order to solve my problem, I need to run below command in Active Directory Server (ADS).

Set-DistributionGroup <group_name> -RequireSenderAuthenticationEnabled $false

which means, the problem is that the distribution group was created with default settings which means it doesn't receive email from external senders.

My questions are:

1- What does it mean "External Sender" that exchange does not accept my email in the above sentence?

2- if I do not want to run above command, how my application can pretend as it is not an external sender? (please take note that when I used outlook I could send email to that DL email and it was successful but from my application I couldn't. please advice me.

my code is in below for your reference.

using (var client = new SmtpClient("14.19.21.23"))
            {
                try
                {
                    MailMessage newMail = new MailMessage();
                    newMail.From = new MailAddress("[email protected]", "[email protected]");

                    newMail.To.Add(new MailAddress("[email protected]", "DL-Team"));

                    newMail.Subject = "subject";
                    newMail.Body = "Mail body";
                    newMail.SubjectEncoding = Encoding.UTF8;

                    newMail.IsBodyHtml = true;
                    client.UseDefaultCredentials = false;    // true is working
                    client.Credentials = new System.Net.NetworkCredential("username", "password", "companydomain");
                    client.DeliveryMethod = SmtpDeliveryMethod.Network;

                    client.Send(newMail);
                }
                catch (Exception ex)
                {
                    throw new Exception("Sending mail failed due to :" + ex.Message, ex);
                }
            }

EDIT1: I observer that SMTP client is not using my credential! what I mean is that even if I use the wrong password there is no issue! any idea? Based on my research SMTP is using the easiest way to send mail, therefore it might use my PC details. can you share your idea? our company support below protocol[NTLM, GSSAPI]:

telnet 14.19.21.23 25
220 *****************************
EHLO www.Company.com
250-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXA
250-SIZE 37748736
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-XXXXXXXB
250-XXXXXXXXXXXXXC
250-AUTH NTLM
250-XXXXXXXXXXXXXXXXXD
250-8BITMIME
250-BINARYMIME
250-XXXXXXXE
250 XXXXF
Boabdil answered 14/6, 2019 at 20:36 Comment(1)
Any idea guysssss...Boabdil
B
0

The problem was due to manage delivery setting.

You should change the delivery management option for “your distributed email” distributed list from “only senders inside my organization” to “Senders inside and outside of my organization.”

enter image description here

you can do it with below shell script also.

Set-DistributionGroup <your distribute email> -RequireSenderAuthenticationEnabled $false
Boabdil answered 20/6, 2019 at 10:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.