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
%>