Outlook
A family of Microsoft email and calendar products.
4,504 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
"I am trying to programmatically email a password to a new user from my Azure website via the vb.net 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 'website.com'
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 'website.com' "
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.EnableSsl = True SmtpServer.DeliveryFormat = 1
SmtpServer.DeliveryFormat = 1
SmtpServer.Port = 25
SmtpServer.Host = "website-com.mail.protection.outlook.com"
mail = New MailMessage()
mail.From = New MailAddress("******@website.com")
mail.To.Add(******@gmail.com)
mail.Bcc.Add("******@website.com")
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"
SmtpServer.Send(mail)
I am not fixated on an approach, but I would appreciate a solid long term solution.
Thanks !!