ASP used JMail, CDO email
Some time ago, have been a simple JMAIL mail, e-mail code, put this code to a specific comment, and an increase of two other format code, both a few simple examples:
The first is the core code jmail.smtpmail:
<%
Set jmail = Server.CreateObject ( "JMAIL.SMTPMail") 'object creation of a JMAIL
Jmail.silent = true 'JMAIL not dished out an exception error, the return of value to TRUE to FALSE
Jmail.logging = true 'Enable use log
Jmail.Charset = "GB2312" 'e-mail text code for Simplified Chinese
Jmail.ContentType = "text / html" 'e-mail in HTML format
Jmail.ServerAddress = "Server Address" 'email servers
Jmail.AddRecipient Email 'e-mail recipient
Jmail.SenderName = "SenderName" 'e-mail sender's name
Jmail.Sender = "Email Address" 'Send an e-mail to e-mail address
Jmail.Priority = 1 'e-mail emergency procedures, one for the fastest and the slowest for 5, 3 for the default value
Jmail.Subject = "Mail Subject" 'the title of mail
Jmail.Body = "Mail Body" 'the content of e-mail
Jmail.AddRecipientBCC Email 'secret document, the recipient's address
Jmail.AddRecipientCC Email 'copied the e-mail addresses
Jmail.Execute () 'implementation of mailing
Jmail.Close 'Close mail object
%>
W3 Jmail4.3 components redesigned its internal structure - Message use of a single object instead of the original target Jmail.smtpmail email, and some require authentication methods (such as 163, yahoo, etc.), can use the following solutions:
<%
Set jmail = Server.CreateObject ( "JMAIL.Message") 'the object of the establishment of email
Jmail.silent = true 'shielding exception error, return FALSE with the TRUE value j 2
Mail.logging = true 'opening mail log
Jmail.Charset = "GB2312" 'the e-mail text encoding for GB
Jmail.ContentType = "text / html" 'e-mail as HTML format
Jmail.AddRecipient Email 'e-mail address of the addressee
Jmail.From = "Email From for Sender" 'the sender's address E-MAIL
Jmail.MailServerUserName = "UserName of Email" 'Login mail server for the user name
Jmail.MailServerPassword = "Password of Email" 'login passwords for e-mail server
Jmail.Subject = "Mail Subject" 'the title of mail
Jmail.Body = "Mail Body" 'the content of e-mail
Jmail.Prority = 1 'e-mail emergency procedures, one for the fastest and the slowest for 5, 3 for the default value
Jmail.Send ( "Server Address") 'implementation mail (through the mail server address)
Jmail.Close () 'object Close
%>
Negotiations to Microsoft onboard CDONTS components of the letter:
<%
Set cdomail = Server.CreateObject ( "CDONTS.NewMail") 'object the establishment of e-mail
Cdomail.Subject = "Mail Subject" 'mail Title
Cdomail.From = "Sender's Mail" 'the sender's address
Cdomail.To = "Email will from the" 'address of the addressee
Cdomail.Body = "Mail Body" 'the content of e-mail
Cdomail.Send 'implementation sent
%>
Email this method is the most simple, but it also brings some problems, is a little server this service!
We write procedures, under normal circumstances are that the code should be modular so easy to maintain, but also facilitate the transplant. Therefore, I will be here in this e-mail written in a subset of the way, the time can be called directly call (Of course, if you wrote pleased if they can function, the main interest is to see individuals):
<%
'Parameters Remarks
'Subject: Mail title
'MailAddress: the address of the server, such as smtp.163.com
'Email: e-mail address of the addressee
'Sender: the sender's name
'Content: Content
'Fromer: the sender's e-mail address
Sub SendAction (subject, mailaddress, email, sender, content, fromer)
Set jmail = Server.CreateObject ( "JMAIL.SMTPMail") 'object creation of a JMAIL
Jmail.silent = true 'JMAIL not dished out an exception error, the return of value to TRUE to FALSE
Jmail.logging = true 'Enable use log
Jmail.Charset = "GB2312" 'e-mail text code for Simplified Chinese
Jmail.ContentType = "text / html" 'e-mail in HTML format
Jmail.ServerAddress = mailaddress' Send e-mail server
Jmail.AddRecipient Email 'e-mail recipient
Jmail.SenderName sender = 'e-mail sender's name
Fromer jmail.Sender = 'e-mail sender's e-mail address
Jmail.Priority = 1 'e-mail emergency procedures, one for the fastest and the slowest for 5, 3 for the default value
Jmail.Subject subject = 'e-mail title
Jmail.Body content = 'e-mail content
'In the absence of copy with the use of copied, the two masked here, if you need, you can resume here
'Jmail.AddRecipientBCC Email' secret document, the recipient's address
'Jmail.AddRecipientCC Email' copied the e-mail addresses
Jmail.Execute () 'implementation of mailing
Jmail.Close 'Close mail object
End Sub
'Sub example of this call
Dim strSubject, strEmail, strMailAdress, strSender, strContent, strFromer
StrSubject = "This is a test sent by mail JMAIL"
StrContent = "JMail components sent test success!"
StrEmail = "runbing@eyou.com"
StrFromer = "runbing@eyou.com"
StrMailAddress = "mail.ubbcn.com"
Call SendAction (strSubject, strMailaddress, strEmail, strSender, strContent, strFromer)
%>
These are the messages I have a rough code of opinion, we forgot generous know!








0 Comments to “ASP used JMail, CDO email”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.