怎么使用ASP和JMAIL在代理下网的环境中实现邮件发送功能。分不多。还是希望高手能指点

如何使用ASP和JMAIL在代理上网的环境中实现邮件发送功能。分不多。还是希望高手能指点
index.htm
HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>例子</title>
</head>
<body>
    <form id="form1" name="form1" method="post" action="ListFriend.asp">
    <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="71" height="30" align="right">
                邮箱:
            </td>
            <td width="429" height="30">
                <select size="1" name="domains">
                    <option value="163" selected="selected">@163.com 网易</option>
                    <option value="sina">@sina.com 新浪</option>
                </select>
                *
            </td>
        </tr>
        <tr>
            <td height="30" align="right">
                用户名:
            </td>
            <td height="30">
                <input size="23" name="uName" />
                *(例:myemail)
            </td>
        </tr>
        <tr>
            <td height="30" align="right">
                密码:
            </td>
            <td height="30">
                <input type="password" size="19" name="uPw" />
                *
            </td>
        </tr>
        <tr>
            <td height="30" align="right">
                收件人:
            </td>
            <td height="30">
                <input name="sendTo" type="text" id="sendTo" size="35" />
                *(例:XX@126.com)
            </td>
        </tr>
        <tr>
            <td height="30" align="right">
                标题:
            </td>
            <td height="30">
                <input name="Title" type="text" id="Title" value="AAAAAA" size="50" />
                *
            </td>
        </tr>
        <tr>
            <td height="30" align="right">
                内容:
            </td>
            <td height="30">
                <textarea name="Content" cols="50" rows="6" id="Content"><%=Content%></textarea>
                *
            </td>
        </tr>
        <tr>
            <td height="30" align="right">
                <input name="doWhat" type="hidden" id="doWhat" value="sendEmail" />
            </td>
            <td height="30">
                <input tabindex="4" type="submit" value=" 发 送 " name="sub" style="height: 1.67em;
                    width: 5.0em; font-size: 13px" />
                (点击发送后请稍等提示...)
            </td>
        </tr>
    </table>
    </form>
</body>
</html>




ListFriend.asp
VBScript code

<%
'括号::发送邮件服务器,邮件接收人,发送人,登录邮箱的用户名,登录邮箱的密码,邮件主题,邮件内容
function sendmail(smtp,sendto,from,user,pwd,subject,body)
Set jmail = Server.CreateObject("JMAIL.Message") '建立发送邮件的对象 
jmail.silent = true '屏蔽例外错误,返回FALSE跟TRUE两值j 
jmail.logging = true '启用邮件日志 
'加上如下语句,否则还有可能出现乱码的可能性: 
jmail.Charset = "GB2312" '邮件的文字编码为国标 
jmail.ContentTransferEncoding = "base64"   
jmail.Encoding = "base64"   
jmail.ISOEncodeHeaders = false

'jmail.ContentType = "text/html" '邮件的格式为HTML格式 -- 有此句则发送附件时为乱码
jmail.AddRecipient sendto '邮件收件人的地址 
jmail.From = from '发件人的E-MAIL地址 
jmail.MailServerUserName = user '登录邮件服务器所需的用户名 
jmail.MailServerPassword = pwd '登录邮件服务器所需的密码 
jmail.Subject = subject '邮件的标题 
jmail.Body = body '邮件的内容 
'jmail.AddAttachment Server.MapPath("login.gif")'附件--不能有此句:jmail.ContentType = "text/html"
'Jmail.AddAttachment Server.MapPath("b.rar")       '否则附件会变成乱码
jmail.Priority = 3 '邮件的紧急程序,1 为最快,5 为最慢, 3 为默认值 
if jmail.send(smtp)=false then'执行邮件发送(通过邮件服务器地址) 
     sendmail=0
else
     sendmail=1
end if
jmail.Close
end function

doWhat=request("doWhat")
Content=request("Content")

if doWhat="sendEmail" then
domains=request("domains")
uName=request("uName")
uPw=request("uPw")
sendTo=request("sendTo")
Title=request("Title")
'邮件服务器
select case domains
case "163"
   domains="mail.163.com"
   uName=uName&"@163.com"
case "sina"
   domains="smtp.sina.com"
   uName=uName&"@sina.com"
end select

if domains="" or uName="" or uPw="" or sendTo="" or Title="" or Content="" then
   response.write"<script>alert('Null!');history.back(-1);</script>"
   response.End()
end if

'调用发邮件函数
isOK=sendmail(domains,sendTo,uName,uName,uPw,Title,Content)
if isOK=1 then
   response.write"<script>alert('OK!');history.back(-1);</script>"
   response.End()
else
   response.write"<script>alert('ON!');history.back(-1);</script>"
   response.End()
end if
end if
%>