如何使用完整的电子邮件验证在winform中制作电子邮件的抄送字段 [英] How to make a CC field of email in winform with complete email validation

查看:75
本文介绍了如何使用完整的电子邮件验证在winform中制作电子邮件的抄送字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

private void txtEmailCC_Validating(object sender, CancelEventArgs e)
        {
           //in my form their is a field of cc(where we can add multiple email address),so how can we validate this field.if user will enter wrong email address then show -enter correct email address(it should validate email addresses like-01@gmail.com,name0@gmail.com..means as CC field present in our gmail by which we can send email to many people).
            
        }

推荐答案

使用如下所示的正则表达式函数
use regex function like below
string[] aryMailId = txtcc.text.split(",");
for (i=0;i<arraylist.length;i++)>
{
    string Inputstr=aryMailId[i];
    Match rex = Regex.Match(Strings.Trim(InputStr),"^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,3})


",RegexOptions.IgnoreCase); 如果(rex.Success == false ) { // 消息错误 } }
", RegexOptions.IgnoreCase); if (rex.Success == false) { //message ERROR } }


祝您编码愉快!
:)


Happy Coding!
:)


这篇关于如何使用完整的电子邮件验证在winform中制作电子邮件的抄送字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆