开发者

how to check for specific words/phrase in a textbox in vb.net

开发者 https://www.devze.com 2022-12-15 07:34 出处:网络
I need to check for specific words so that the program will know what smtp client will be used. For example. If the from textbox will have @yahoo.com on it then the program will make use of the smtp f

I need to check for specific words so that the program will know what smtp client will be used. For example. If the from textbox will have @yahoo.com on it then the program will make use of the smtp for yahoo. Or if you know of any way on how to do just the same but with ot开发者_JAVA百科her idea.


You can't make this work in the general case, just a server name isn't enough. The days that SMTP servers accepted an email message without any authentication are long gone. You will need to use the SmtpClient.Credentials property to proof to the server that the user is legit.

Perhaps more to the point, you only need one SMTP server. As long as the user can authenticate, s/he can use the server to distribute email to any recipient. Add a configuration feature to your app so the user can provide the server address, port number and required credentials.


    If yourTextBox.Text.Contains("@yahoo.com") Then
        'make use of smtp for yahoo
    End If

And if you have more complicated phrases/rules to find, make yourself comfortable with regular expressions.

0

精彩评论

暂无评论...
验证码 换一张
取 消