I have a couple questions in regard to my Web form. What is basically happening is that it is pulling the emails from a database and BCC'ing a message to all of them. The mailing list at max would be 600 members.
Here are my questions:
1. I would like to set it up to handle attachments (at least 4)
2. Is this setup to handle HTML (for the body) and use the Reply-To field properly?
3. Is it the best way to code a CDO form? I want as less of a chance as possible that this will be detected as spam. Would it be better if I sent the e-mails out individually? If so, how? I don't want it to timeout before all the e-mails are sent.
I'm going to need some help making these changes as I don't know my way around this very well.
Thanks!
Here is the code I am using:
This is the form:
formpage.asp
I had this code in CDONTS form, but I was told to convert it to CDO, I tried, but I need someone to check it over, and then respond to my questions above.
results.asp
Here are my questions:
1. I would like to set it up to handle attachments (at least 4)
2. Is this setup to handle HTML (for the body) and use the Reply-To field properly?
3. Is it the best way to code a CDO form? I want as less of a chance as possible that this will be detected as spam. Would it be better if I sent the e-mails out individually? If so, how? I don't want it to timeout before all the e-mails are sent.
I'm going to need some help making these changes as I don't know my way around this very well.
Thanks!
Here is the code I am using:
This is the form:
formpage.asp
Code:
<form name="Email" method="Post" action="results.asp">
<table width="428">
<tr>
<td width="24"><b>Subject: </b> </td>
<td colspan="3"><input type="text" name="Subject" size="40"></td>
</tr>
<tr>
<td width="24"><b>ReplyTo: </b> </td>
<td colspan="3"><input type="text" name="ReplyTo" size="40"></td>
</tr>
<tr>
<td colspan=4> </td>
</tr>
<tr>
<td colspan=4><b>Send to those interested in:</b></td>
</tr>
<tr>
<td width="141" colspan="2"><INPUT Type=Checkbox Name="sport" Value="baseball=true"> Baseball</td>
<td width="112"><INPUT Type=Checkbox Name="sport" Value="soccer=true"> Soccer</td>
<td width="139"><INPUT Type=Checkbox Name="sport" Value="volleyball=true"> Volleyball</td>
</tr>
<tr>
<td width="141" colspan="2"><INPUT Type=Checkbox Name="sport" Value="basketball=true"> Basketball</td>
<td width="112"><INPUT Type=Checkbox Name="sport" Value="softball=true"> Softball</td>
<td width="139"><INPUT Type=Checkbox Name="sport" Value="wrestling=true"> Wrestling</td>
</tr>
<tr>
<td width="141" colspan="2">
<INPUT Type=Checkbox Name="sport" Value="crosscountry=true"> Cross Country</td>
<td width="112"><INPUT Type=Checkbox Name="sport" Value="swimming=true"> Swimming</td>
<td width="139"><INPUT Type=Checkbox Name="sport" Value="boardmember=true"> Board Members</td>
</tr>
<tr>
<td width="141" colspan="2">
<INPUT Type=Checkbox Name="sport" Value="football=true"> Football</td>
<td width="112"><INPUT Type=Checkbox Name="sport" Value="track=true"> Track</td>
<td width="139">
<INPUT Type=Checkbox Name="sport" Value="administrator=true"> Admins</td>
</tr>
<tr>
<td width="141" colspan="2"> </td>
<td colspan="2"> </td>
<tr>
<td width="141" colspan="2"><b>Comments: </b> </td>
<td colspan="2"> </td>
<tr>
<td colspan="4"><textarea rows=9 cols=48 name="Comments"></textarea></td>
</table>
<input type="submit" name="Submit" value="Submit Form">
</form>
I had this code in CDONTS form, but I was told to convert it to CDO, I tried, but I need someone to check it over, and then respond to my questions above.
results.asp
Code:
<%@ LANGUAGE=JScript %>
<%
var db = Server.CreateObject("ADODB.Connection");
db.Open("ioa");
var sql = "SELECT email FROM Members WHERE ADMINISTRATOR = True";
var sports = Request("sport").Item;
if ( sports != null && sports != "" )
{
sports = sports.replace( /,/g , " OR " ); // change each comma to SQL OR keyword
sql += " AND ( " + sports + " ) "
}
sql += " ORDER BY lastname, firstname"
Response.Write( "DEBUG SQL: " + sql + "<HR>" ); // just to show what is happening
var rs = db.Execute(sql);
if( db.Errors.Count != 0 ) Response.Redirect("default.asp");
while ( ! rs.EOF )
{
Set myMail=CreateObject("CDO.NewMail");
myMail.Bcc= rs("EMail").Value;
myMail.From= "webadmin@email.com";
myMail.Replyto= Request("Replyto");
myMail.Subject= Request("Subject");
myMail.HTMLBody = Request("Comments");
myMail.Send
rs.MoveNext();
}
%>