Difference between revisions of "ASP.NET Mail"
From KOP KB
(→Comparing strings to avoid email issues) |
|||
Line 1: | Line 1: | ||
= Comparing strings to avoid email issues = | = Comparing strings to avoid email issues = | ||
− | + | Pretty much if the email is blank it will cause the script to error and this way you can check for that and then replace the email with noreply just so it will go through | |
<syntaxhighlight lang="vbnet"> | <syntaxhighlight lang="vbnet"> | ||
dim str1 As String = txtReceiptEmail.Text.ToString() | dim str1 As String = txtReceiptEmail.Text.ToString() |
Latest revision as of 18:23, 16 October 2015
Comparing strings to avoid email issues
Pretty much if the email is blank it will cause the script to error and this way you can check for that and then replace the email with noreply just so it will go through
dim str1 As String = txtReceiptEmail.Text.ToString()
dim str2 As String = ""
if String.Compare(str1, str2) = 0 Then
message = New System.Net.Mail.MailMessage("[email protected]", "[email protected]")
else
message = New System.Net.Mail.MailMessage("[email protected]", txtReceiptEmail.Text)
end if