|
|
|
3w....Learning.tutorials
>
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")
|
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
|
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>"
|
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" ]
|
|
| .. |
| ... |
| ... |
|
|