Send an HTML formatted message with an attachment [turn] can be with an attachment yo. The essence of the reference?

Source: Internet
Author: User
Tags format mail reference
Essence send an HTML-formatted message routine with attachments


How can I send a message with an attachment and HTML format via ASP? A routine is provided below.

<%@ language=vbscript%>
<%
Response.Buffer = True
Response.Expires = 0

' Create an object instance
Set mymail = Server.CreateObject ("CDONTS. NewMail ")

' The following is what will be sent
HTML = "html = html & "html = html & "<title>sending cdonts Email Using html</title>"
html = html & "html = html & "<body bgcolor=" "FFFFFF" ">"
html = html & "<p><font size=7>"
html = HTML & "This are a test mail in html<br>"
html = html & "Mail content here ...</font></p>"
html = html & "</body>"
html = html & "
' Sender
Mymail.from = "Somebody@somewhere.com"

' Recipient
mymail.to = "Nobody@somewhere.com"

' Bcc
MYMAIL.BCC = "Nobody@somewhere.com"

' CC
mymail.cc = "Nobody@somewhere.com"

' The importance of mail
' 0 importance Low
' 1 importance general (default)
' 2 High importance
Mymail.importance = 2

' Message subject
Mymail.subject = "Test Mail in HTML"

' Attachment (note that E:\test.txt refers to the location on the server and, if a relative path is used, must be mapped to the true path with Server.MapPath)
Mymail.attachfile "E:\test.txt"

' NewMail object's text format
' 0 means that the body can contain Hypertext Markup Language (HTML)
' 1 means that the body is used only for plain text (default value)
Mymail.bodyformat = 0

' NewMail Object Settings encoding
' 0 means the MIME format will be used
' 1 indicates that a continuous plain text will be used (default value)
Mymail.mailformat = 0

' Assigning text to a Message object
Mymail.body = HTML

' Send the message
Mymail.send

' Destroying object instances, freeing up memory
Set MyMail = Nothing
%>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.