测试电子邮件 [英] test if email

查看:84
本文介绍了测试电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

Python stdlib中是否有一个函数来测试一个字符串是否是一个有效的

电子邮件地址?


谢谢,


florian

解决方案

10月12日下午2:55,Florian Lindner< ; Florian.Lind ... @ xgm.dewrote:


你好,

Python stdlib中是否有一个函数来测试是否有string是有效的

电子邮件地址?


谢谢,


florian



你什么意思?如果您只是测试电子邮件

地址字符串的构造,那么它非常简单。如果您想知道

电子邮件地址是否有效且可靠,那么可靠地找到

的唯一方法就是在那里发送一封测试邮件,看它是否有效通过或者

跳出来。


这里有一篇关于这个主题的有趣文章,完全不是与b $ Python相关的


http:/ /www.oreillynet.com/onlamp/blo...ail_addre.html

Mike


< blockquote> Florian Lindner写道:


你好,

Python stdlib中有一个函数来测试字符串是否有效

电子邮件地址?



不,大多数带有@的字符串都可能是有效的电子邮件地址。发送

a消息给addy,如果它没有反弹,那么它是有效的。


2007年12月10日,Florian Lindner< Fl ************* @ xgm.dewrote:


你好,

Python stdlib中是否有一个函数来测试一个字符串是否是一个有效的

电子邮件地址?



你的意思是一个有效的SMTP电子邮件地址?


实际上,没有办法做到这一点。但是一个好的经验法则

如果它至少没有一个''''符号,至少有一个'''。''

在最右边的''''符号右边,它对于

互联网传输是无效的。


如果你的意思是测试是否一个字符串是一个现有的电子邮件地址,然后

再次没有万无一失的测试方法。有效的电子邮件地址

可能会因各种原因而退回,而无效的电子邮件地址也不会因为b $ b总是反弹。使用与服务器的SMTP对话而不发送

电子邮件可以具有相同的反弹/非反弹(实际上,接受/拒绝)

结果。


HTH :)


Hello,
is there a function in the Python stdlib to test if a string is a valid
email address?

Thanks,

florian

解决方案

On Oct 12, 2:55 pm, Florian Lindner <Florian.Lind...@xgm.dewrote:

Hello,
is there a function in the Python stdlib to test if a string is a valid
email address?

Thanks,

florian

What do you mean? If you''re just testing the construction of the email
address string, then it''s pretty easy. If you want to know if the
email address is live and works, the only way to reliably find that
out is to send a test email there to see if it goes through or
bounces.

Here''s an interesting article on the topic, which is completely non-
Python related:

http://www.oreillynet.com/onlamp/blo...ail_addre.html

Mike


Florian Lindner wrote:

Hello,
is there a function in the Python stdlib to test if a string is a valid
email address?

Nope, most any string with an @ in it could be a valid email addy. Send
a message to the addy, if it doesn''t bounce, then it''s valid.


On 12/10/2007, Florian Lindner <Fl*************@xgm.dewrote:

Hello,
is there a function in the Python stdlib to test if a string is a valid
email address?

You mean a valid SMTP email address?

In reality, there isn''t a way of doing this. But a good rule of thumb
is if it hasn''t got at least one ''@'' symbol with at least one ''.'' to
the right of the right-most ''@'' symbol then it isn''t valid for
internet transmission.

If you meant "test if a string is an existing email address", then
again there is no foolproof way of testing. Valid email addresses
can bounce for a variety of reasons, and invalid email addresses don''t
always bounce. Using an SMTP dialogue with the server without sending
an email can have the same bounce/non-bounce (actually, accept/refuse)
results.

HTH :)


这篇关于测试电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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