Azure Web Application programmatically send subscription password via email to Clients (A2P) SMTP relay to Office 365 business email account not working

Carlos 0 Reputation points
"I am trying to programmatically email a password to a new user from my Azure website via the code in my *.aspx signup page. 
Options tried include: 
1) Programmatically send SMTP relay to client via my Office365 Business Basic Email account, OR 
2) trying the new Azure Email Communication Service 
I have had no success with either option to date. 
Option 1:  
I have a connector setup on Office 365 Exchange server to accept communications from my azure website with SSL certificate which includes name ''
The following code worked 3/6/2023 on the website from my *.aspx signup page using PORT 25 but not locally in Visual Studio.  
I tried changing to PORT 587 and it failed.  
After reverting to PORT 25 it no longer worked either with ERROR: 'Mailbox Not available'
I have a connector setup on Office 365 Exchange server to accept communications from mail server with certificate which includes name ''  "

 Dim SmtpServer As New SmtpClient()
            Dim mail As New MailMessage()
            SmtpServer.EnableSsl = True                                                                                                                                SmtpServer.DeliveryFormat = 1
            SmtpServer.DeliveryFormat = 1                                                                                                                       
            SmtpServer.Port = 25
            SmtpServer.Host = ""
            mail = New MailMessage()
            mail.From = New MailAddress("")
            mail.Subject = "Your password for downloading"                                                                                                                              
            mail.SubjectEncoding = System.Text.Encoding.UTF8
            mail.BodyEncoding = System.Text.Encoding.UTF8
            mail.IsBodyHtml = True
            mail.Body = "Testing SMTP mail from Azure To Microsoft Office Basic 365"

I am not fixated on an approach, but I would appreciate a solid long term solution. 
  Thanks !! 
A family of Microsoft email and calendar products.
2,664 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,440 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,313 questions
{count} votes