How do you do Authetication Using NTLM MSEXCHAGE 2016 RRS feed

  • Question

  • Iam using and Exchange 2016  :I want to send notifications to more than 1000 employees using the procedure below am getting an error {GETTTING ERROR Mail box unavailable 5.7.1 PRA NOT PERMITED }

    IT department are telling me that i have to authenticate using NTLM How do i do this in OR C#

    Sub sendEmail(Optional theRecipient As String = "", Optional theCCRecipient As String = "", Optional theBCCRecipient As String = "", Optional theSubject As String = "", Optional theMailText As String = "", Optional theAuditTrailRef As Integer = 0, Optional theAuditTrailText As String = "", Optional theAttachment As String = "", Optional theReply2Email As String = "")
            Dim fromAddress As System.Net.Mail.MailAddres

            Dim toAddress As System.Net.Mail.MailAddress
            Dim objMiddleTier As New GlobalDB_fxns(myConn)

            Dim objSMTPUserInfo As New System.Net.NetworkCredential

            fromAddress = New MailAddress(objMiddleTier.SendMailFromThisAddress)
            toAddress = New MailAddress(theRecipient)

            ' Dim mailSender As SmtpClient
            ' Change the Smtp server name on the next line
            'mailSender = New SmtpClient("", objMiddleTier.SMTPPortNumber)
            Dim mailSender As New SmtpClient()
            mailSender.Host = ""
            mailSender.Port = objMiddleTier.SMTPPortNumber '25
                mailSender.UseDefaultCredentials = False
            'mailSender.Credentials = New System.Net.NetworkCredential(objMiddleTier.SMTPUserName,objMiddleTier.SMTPUserPassword, ldap)
            objSMTPUserInfo = New System.Net.NetworkCredential(objMiddleTier.SMTPUserName,objMiddleTier.SMTPUserPassword) ', ldap)
            mailSender.Credentials = objSMTPUserInfo
            mailSender.UseDefaultCredentials = False
            mailSender.DeliveryMethod = SmtpDeliveryMethod.Network


            Dim message As New MailMessage(fromAddress, toAddress)

            If Not theBCCRecipient Is Nothing And theBCCRecipient <> String.Empty Then
                ' Set the Bcc address of the mail message
                message.Bcc.Add(New MailAddress(theBCCRecipient))
            End If
            If Not theCCRecipient Is Nothing And theCCRecipient <> String.Empty Then
                ' Set the CC address of the mail message
                message.CC.Add(New MailAddress(theCCRecipient))
            End If

            message.Subject = theSubject
            message.IsBodyHtml = True ' False
            message.Body = theMailText
            If Not theAttachment = "" Then
                Dim msgAttach As New Attachment(theAttachment)
            End If
                ' mailSender.DeliveryMethod = SmtpDeliveryMethod.Network
            Catch ex As Exception
                'write on the eror file
                MessageBox.Show(ex.Message, "Error Mail Not Sent")
            End Try

        End Sub

    Wednesday, December 20, 2017 3:55 AM