html nyhedsbrev i asp
Hej Eksperter.Jeg er på herrens mark da jeg ikke kan finde et simpelt script til at sende nyhedsbreve ud til emails i en access database, som HTML lavet i en WYSIWYG editor.
Jeg er nået dertil hvor jeg har fundet og implementeret en wysiwyg editor i et nyhedsbrev script der er lavet til at sende alm. tekst mails. Det hele virker fint nok bortset fra at det der er skrevet i wysiwyg bliver afleveret som txt i stedet for html.
Min "frankenstein" samlede kode ser sådan her ud:
<%@ LANGUAGE="VBScript" %> <%Option Explicit%> <html> <head> <!-- #include
file="./DBConnect.inc"--> </head> <body>
<%
Dim con, rs, strSql, objMail
If Request.Form("cmdSubmit") <> "" Then
'The user has submitted the page, so process the Newsletter subscription request
'Connect to the database
Set con = GetDBConnection()
'Get all email addresses in the database
strSql = "SELECT Email FROM Subscribers"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSql, con, 1, 2
If rs.EOF Then
'MODIFY the text below displays when no subscribers exist
%>
There are no subscribers to the newsletter.
<%
'Clean up database objects
rs.Close()
Set rs = Nothing
con.Close()
Set con = Nothing
Response.End
End If
While Not(rs.EOF)
Set objMail = Server.CreateObject("CDO.Message")
'MODIFY the following email address will appear as the from address for the email.
objMail.From = "postmaster@theforge.dk"
objMail.To = rs("Email")
objMail.TextBody = Request.Form("txtEmail")
objMail.Subject = "Nyhedsbrev fra C2 Elelments"
objMail.Send
rs.MoveNext()
Wend
'MODIFY the text below displays when all the emails have been sent
%>
The emails have been sent.
<%
'Clean up database objects
rs.Close()
Set rs = Nothing
con.Close()
Set con = Nothing
Else
'MODIFY the text below is displayed when the page is first loaded.
%>
<form action="send.asp" method="post" id=form1 name=form1>
<div align="center">
Enter the email message to send:<br />
<!--
Include the WYSIWYG javascript files
-->
<script type="text/javascript" src="scripts/wysiwyg.js"></script>
<script type="text/javascript" src="scripts/wysiwyg-settings.js"></script>
<!--
Attach the editor on the textareas
-->
<script type="text/javascript">
// Use it to attach the editor to all textareas with full featured setup
//WYSIWYG.attach('all', full);
// Use it to attach the editor directly to a defined textarea
// WYSIWYG.attach('textarea1'); // default setup
WYSIWYG.attach('txtEmail', full); // full featured setup
// WYSIWYG.attach('textarea3', small); // small setup
// Use it to display an iframes instead of a textareas
//WYSIWYG.display('all', full);
</script>
</head>
<body>
<h2>
</h2>
<br>
<textarea id="txtEmail" name="txtEmail" style="width:80%;height:400px;">
</textarea>
<input type="submit" name="cmdSubmit" value="Submit">
</div>
</form>
<%
End If
%>
</body>
</html>
Nogen af jer der kan se noget som gør at mailen bliver afsendt som tekst og ikke html?
På forhånd tusind tak. :-)
