|
|
|
3w....学习.教学
>
ASP
>
email » jmail.smtpmail
|
|
|
| 3w learning
|
email > jmail.smtpmail
Title:Set JMail = Server.CreateObject("JMail.SMTPMail")
use JMail.SMTPMail to send email
----- you may set a different name as you wish ---
set SMTP=Server.CreateObject("Jmail.SMTPMail")
要求伺服主机以JMail.SMTPMail来寄信 |
Description:
First:: To confirm your web server does have JMail service
installed before you run JMail.SMTPMail
create and send a email by using Jmail.SMTPMail
It often been used to create autoresponse email
example: member information , forgot password
email sending.
you may send text or html form
Plain Text format
[ linebreaks to the mailbody Use vbcrlf ]
example: JMail.AppendText "Dear," & vbCrLf
HTML format must have ContentType
[ JMail.ContentType = "text/html" ]
------------- attention --------------
Sender email address and AddRecipient (receiver)
email address are required to be listed by Jmail
Every email has its unity ID even if
you used false info, your location still will be
listed at many servers. [ no way to hide ]
-------attention :: internet security -----------
set your email browser to read only text format
is always safer than to read HTML format
even if preview a HTML format
请先确认你的主机是否有安装JMail的服务项目
经常被使用在会员数据的自动寄出
与会员忘记密码数据要求时的自动寄出
----注意网络安全----
最佳设定你的电子邮件信箱浏览方式为::
将信件全以text文字化显示出
(你将会看到所有的HTML的原始档)
请记得若以HTML读取或预览任何
信件时,是有可能会提升你的计算机被骇的危险性
|
Example Code:
<%
Email=request("send-to-where-email")
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "your-server-name"
Jmail.ContentTransferEncoding = "base64"
Jmail.ISOEncodeHeaders = false
JMail.ContentType = "text/html"
JMail.Encoding = "base64"
JMail.MimeVersion = "1.0"
JMail.sender = "your@email"
JMail.SenderName= "sender name"
JMail.Subject = "mail subject"
JMail.AddRecipient Email
JMail.ReplyTo="email@--1--.com"
JMail.ReplyTo="email@--2--.com
JMail.Body ="<meta http-equiv=Content-Type
content=text/html; charset=utf-8>"
JMail.Body =JMail.Body& "Hi, this is an ASP Jmail
example HTML mail<br>"
JMail.Body =JMail.Body&"<a href=
""http://-------/asp/email"">
http://-------/asp/email</a> <br> "
JMail.Priority=3
JMail.Execute
set JMail=nothing
%>
---------------------------------------
your-server-name :: can be a domain name or an IP
it depends on your server setting
if you rent a hosting then you shall ask your ISP support
--- Example 2 ---
<% '---- login SMTP pw to send email ---
dim username, email, tel, memo
username=Trim(request("username"))
email=Trim(request("email"))
tel=Trim(request("tel"))
memo=Trim(request("memo"))
Set JMail = Server.CreateObject("Jmail.Message")
JMail.silent=true
JMail.Logging = true
JMail.Charset = "utf-8"
JMail.ContentType = "text/html"
JMail.MailServerUserName = "SMTP-account@---.com"'SMTP account
JMail.MailServerPassword = "Pass word" 'SMTP pw
JMail.From = "sender-email@---.com"
JMail.FromName = "sender name"
JMail.AddRecipient email ' receiver email
JMail.Subject = "a test mail"
Body= "receiver:" & username & "<br>Tel:" & tel & now
Body=Body&"<br>email:" & email & "<br>memo:" & memo
Body=Body&"<br><font size=5>Best Regards,<br>Ezer</font>"
JMail.Body = Body
JMail.Send ("mail.----.com")'set SMTP Server
set JMail = nothing
response.write "mail sent" & chr(13) & "ok"
Response.End
%>
Example3 -------Ezer.com-----
yes you may use
vbCrLf to replace "<br>"
chr(13) to replace "<br>"
-----Ezer----- tips --------
chr(10) a 'line feed' ; returns a linefeed character
chr(13) a 'carriage return' ; returns a carriage return character
they are different
-----------larger font for text/html form--------
"<font size=""5"">Best Regards,<br>Ezer</font>"
or
"<font size=5>Best Regards,<br>Ezer</font>"
or
"<h1>Best Regards,<br>Ezer</h1>"
-----------add an image for text/html form -----------
"<a href=""http://__""><img src=""http://__.gif"" border=""0""></a>"
or
"<a href=http://___><img src=http://___.gif border=0></a>"
主机名可网址文字化或IP
可同时寄出多封电子信 |
Example Result:
Sender : your@email
receiver: Email@email
subject : mail subject
Hi, this is an ASP Jmail example HTML mail
http://3w.ezer.com/asp/email
--------------------------------------
this jmail example can send html code
by using:
[ JMail.ContentType = "text/html" ]
-------- character conversion --------
[ JMail.ISOEncodeHeaders = false ]
[ Jmail.ContentTransferEncoding = "base64" ] or
[ JMail.ContentTransferEncoding = "8bit" ]
当你希望对方能够读取
你的HTML化的信件时,你可加入
[ JMail.ContentType = "text/html" ]
当然对于也可设定其信箱只读取text文字时
他就会看到你的HTML原始码
|
|
| .. |
| ... |
| ... |
|
|
[ 7/27/2008 ]
|
|
|
| www learning school add more scripts
and tips memo |
|