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" />
<system.net>
<mailSettings>
<smtp>
<network host="smtp.office365.com" password="*****" port="587" userName="****" enableSsl="true"/>
</smtp>
</mailSettings>
<defaultProxy>
<proxy usesystemdefault="False"/>
</defaultProxy>
</system.net>
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.