Office 365 SMTP not working anymore with ASP.NET VB Page

Jeff Thomas 21 Reputation points

I've attempted several changes that I received from Microsoft and still not successful. Everything worked until around February 2022. I understand that Microsoft made some changes in regards to SMTP authentication. I have the SMTP credentials setup in webconfig as seen below and the code is in VB. I appreciate any help I can receive!



A set of technologies in the .NET Framework for building web applications and XML web services.
3,404 questions
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,657 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,358 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lan Huang-MSFT 28,826 Reputation points Microsoft Vendor

    Hi @Jeff Thomas ,
    I simply tested your code, you need to define username.text, vbCrLf will not report an error, or you can use the Environment.NewLine property instead.

    Message.Body = "First Line" + Environment.NewLine + "second line"  

    My code below works fine, you can refer to it.

     <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  
                <asp:Button ID="Button1" runat="server" Text="Button" />  


    				<network host="" password="*****" port="587" userName="****" enableSsl="true"/>  
         <proxy usesystemdefault="False"/>  

    Best regards,
    Lan Huang

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

1 additional answer

Sort by: Most helpful
  1. Jeff Thomas 21 Reputation points

    Thank you for your response! The thread you referenced had the fix! I need to add the "ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12" and it worked! See screen shot below.

    I can't thank you enough! 266407-screenshot-2022-12-01-at-91606-pm.png

    0 comments No comments