惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Application and Cybersecurity Blog
Application and Cybersecurity Blog
The Register - Security
The Register - Security
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
量子位
C
Check Point Blog
博客园 - 【当耐特】
小众软件
小众软件
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
The Last Watchdog
The Last Watchdog
博客园 - Franky
N
Netflix TechBlog - Medium
Webroot Blog
Webroot Blog
A
About on SuperTechFans
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
D
Docker
S
Security Affairs
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
V2EX - 技术
V2EX - 技术
Jina AI
Jina AI
Help Net Security
Help Net Security
L
LangChain Blog
P
Proofpoint News Feed
The Cloudflare Blog
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
Schneier on Security
Schneier on Security
Recent Announcements
Recent Announcements
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
V
Vulnerabilities – Threatpost
Microsoft Security Blog
Microsoft Security Blog
H
Heimdal Security Blog
P
Proofpoint News Feed
O
OpenAI News
H
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
爱范儿
爱范儿
Security Archives - TechRepublic
Security Archives - TechRepublic

博客园 - 北极熊,我来了!

C#获取类以及类下的方法(用于Asp.Net MVC) 使用JavaScript判断用户是否为手机设备 手机端页面自适应解决方案 Asp 邮件发送代码 js 日期字符串转换成日期类型,判断星期几 浅析a标签的4个伪类 C#读取Rss功能函数 《中文防止乱码的万能解决方案》 《小偷程序:自动获取百度天气预报》 Asp.NET使用HTML控件上传文件 《JS两级联动菜单学习全接触》 活动目录ADSI实现添加系统帐号问题!!! ADSI管理Windows2003系统帐号 《IP地址和数字之间转化的算法》 《单域名下整合动网、动易、OBlog程序》 JS读取XML数据 Asp.NET读取Excel数据 [XML系列]Flash读取XML数据 《省市联动功能菜单的实现》
中国频道空间使用Jmail发送邮件
北极熊,我来了! · 2007-05-14 · via 博客园 - 北极熊,我来了!

     最近在弄一个客户的网站,需要使用Asp+JMail发送邮件,在确定空间是支持Jmail组件之后,终于决定要把两年前的老伙计搬出来了,下面是全部的函数代码:

'判断服务器是否支持Jmail发信组建
Function IsObjInstalled(strClassString)
    On Error Resume Next
    IsObjInstalled 
= False
    Err 
= 0
    Dim xTestObj
    Set xTestObj 
= Server.CreateObject(strClassString)
    If 
0 = Err Then IsObjInstalled = True
    Set xTestObj 
= Nothing
    Err 
= 0
End Function

'创建Jmail发信函数
function SendMail(EMail,Subject,MailBody,Priority)
On error resume next
Set JMail
=Server.CreateObject("JMail.Message"'建立发送邮件的对象
if err then
SendMail
= "<br><li>没有安装JMail组件</li>"
err.clear
exit function
end 
if
JMail.silent
=true '屏蔽例外错误,返回FALSE跟TRUE两值
JMail.logging = true '启用邮件日志
jmail.Charset = "GB2312" '邮件的文字编码为国标   
JMail.ContentType = "text/html" '邮件的格式为HTML格式
JMail.AddRecipient Email '邮件收件人的地址  
JMail.From = "china@feisky.com" '发件人的E-MAIL地址 
JMail.MailServerUserName = "china@feisky.com"'登录邮件服务器所需的用户名
JMail.MailServerPassWord = "456123"'登录邮件服务器所需的密码
JMail.Subject=Subject'邮件的标题
JMail.Body=MailBody'邮件的内容
JMail.Priority=Priority  '邮件的紧急程序,1 为最快,5 为最慢, 3 为默认值    
JMail.Send("smtp.feisky.com")'执行邮件发送(通过邮件服务器地址)
JMail.Close
Set JMail
=nothing
end function

Function IsValidEmail(email)
    dim names, name, i, c
    IsValidEmail 
= true
    names 
= Split(email, "@")
    
if UBound(names) <> 1 then
       IsValidEmail 
= false
       exit function
    end 
if
    
for each name in names
        
if Len(name) <= 0 then
            IsValidEmail 
= false
            exit function
        end 
if
        
for i = 1 to Len(name)
            c 
= Lcase(Mid(name, i, 1))
            
if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
               IsValidEmail 
= false
               exit function
             end 
if
       next
       
if Left(name, 1= "." or Right(name, 1= "." then
          IsValidEmail 
= false
          exit function
       end 
if
    next
    
if InStr(names(1), "."<= 0 then
        IsValidEmail 
= false
       exit function
    end 
if
    i 
= Len(names(1)) - InStrRev(names(1), ".")
    
if i <> 2 and i <> 3 then
       IsValidEmail 
= false
       exit function
    end 
if
    
if InStr(email, ".."> 0 then
       IsValidEmail 
= false
    end 
if
End function

       代码其实很简单,以前也是网络上收藏的,只是比较经典吧而且是有效可以使用的,现在Baidu方便是方便,就是急用的时候经常会搜索不出你真正想要的东西,诶,网络垃圾泛滥了。有一点需要注意的是,中国频道的空间,那些都是一样的,就是发送帐号需要写全,不然不能正确发送的。