如何从电子邮件ID获取域名? [英] How to get domain name from email id?

查看:174
本文介绍了如何从电子邮件ID获取域名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我使用经典ASP创建了一个表单。在那里我得到所有的细节,如姓名,地址,指定,电子邮件等。



当用户点击提交按钮然后我应该比较电子邮件的域名使用数据库中的emailid进行身份验证。



我的问题是,我想知道如何编写查询以仅从电子邮件ID获取域名并将其与现有域名进行比较电子邮件ID ..



我不知道...如果您有任何解决方案请分享..



提前致谢。

解决方案

特定的Internet标识符,其中包含

本地解释的字符串,后跟at符号字符(@,

ASCII值64)后跟互联网域。



所以@之后的所有内容都是域名...


要添加到解决方案1,请研究以下链接,它将帮助您构建sql语句:

T-SQL:RIGHT, LEFT,SUBSTRING和CHARINDEX函数 [ ^ ]


使用以下查询,您将能够从电子邮件ID <获取域名< br $>


  DECLARE   @ ID   AS   NVARCHAR  30  )= '  Help@Codeproject.Com' 

SELECT SUBSTRING( @ ID ,CHARINDEX(' @' @ ID )+ 1,LEN( @ ID ))



SELECT RIGHT @ ID ,(LEN( @ ID ) - CHARINDEX(' @' @ ID )))


Hi all,

I have created a form using classic ASP. In that am getting all the details like name,address,designation,email etc.

when the user click the submit button then i should compare the domain name of the email id with the emailid's in database.

My problem is , i want to know how to write a query to get only the domain name from email id and compare it with existing email id's..

I have no idea... Please share if you have any solution for this..

Thanks in advance.

解决方案

specific Internet identifier that contains a
locally interpreted string followed by the at-sign character ("@",
ASCII value 64) followed by an Internet domain.


So everything after the @ is the domain...


To add to solution 1, study the following link which will help you to construct the sql statement:
T-SQL: RIGHT, LEFT, SUBSTRING and CHARINDEX Functions[^]


Using this below Query you will be able to get domain name from the email ID

DECLARE @ID AS NVARCHAR(30)='Help@Codeproject.Com'

SELECT SUBSTRING(@ID,CHARINDEX('@',@ID)+1,LEN(@ID))

OR

SELECT RIGHT(@ID,(LEN(@ID)-CHARINDEX('@',@ID)))


这篇关于如何从电子邮件ID获取域名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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