Αρχή :: Ενότητες :: Scripting :: Απαντήσεις     
 

Forum

ASP EMAIL TO HTML - Από {nikoss}

na stelnei to email body se HTML format anti gia text kodika edo:
<%
'our constants
Const adOpenKeyset = 1
Const adLockReadOnly = 1
Const adCmdTable = &H0002
'our variables for the email and for our objects
Dim strTo , strFrom , strSubject , strHTML , objCDONTS , objRS , objConn
'get the results from the create newsletter form
strFrom = Request.Form("from")
strSubject = Request.Form("subject")
strstrHTML = Request.Form("message")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DBQ=" & Server.MapPath("meloi.mdb")& ";Driver={Microsoft Access Driver (*.mdb)}"
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.Open "tblMembers" , objConn ,adOpenKeyset ,adLockReadOnly,adCmdTable
'just a message to the admin
Response.Write ("Newsletters are being created")
response.Write ("
")
'loop through entries
While not objRS.EOF
'create an instance of the CDONTS object
Set objCDONTS = Server.CreateObject("CDONTS.NewMail")
'set objCDONTS various properties
objCDONTS.From = strFrom
objCDONTS.To = objRS("Email")
objCDONTS.Subject = strSubject
objCdonts.BodyFormat = 0
objCdonts.MailFormat = 0
objCDONTS.Body = strHTML
objCDONTS.Send
Set objCDONTS = Nothing
'print message for every entry
Response.Write ("message sent to " & objRS("Email") & "
")
'move to next entry in database
objRS.MoveNext
Wend
'message to admin saying creation has completed
Response.Write ("Entaksi ")
%>

 


Απάντηση από:Alex

Πρέπει να δημιουργήσεις το μήνυμα σε html πρώτα.

strHTML = strHTML & "<html><head><title>παράδειγμα html email</title></head>"
strHTML = strHTML & "<body>"
strHTML = strHTML & "<p>κείμενο εδώ</p>"
strHTML = strHTML & "<br><hr>"
strHTML = strHTML & "<a href=""tip.gr"">asp site</a>"
strHTML = strHTML & "</body></html>"



tip: Unlimited Profesional ASP.NET 4.0 Hosting.+ MSSQL με 2,30 € το μήνα * F5 για νέο tip

   Πίσω στην προηγούμενη σελίδα






Η Εταιρία | Web Hosting | Domain names | Web Information | Υπηρεσίες | Resellers | Υποστήριξη |
Copyright © 2007–09 4GR.NETWORKS, All rights reserved.