S
Steven Scaife
There seems to be a problem with my emailing code, although during testing
it worked fine. What happens is it sends two emails instead of one, and
also doesn't put any text in the email for some addresses. Its sent as
plain text and as i said when i tested it to 6 email addresses it worked
fine.
my code is below
<%@LANGUAGE="VBSCRIPT"%>
<% option explicit %>
<%
server.ScriptTimeout=300
response.buffer = true
dim newsletter, arrEmail, i, addresslist, pCount
newsletter = request.form("newsletter")
newsletter = replace(newsletter, "'", "''")
newsletter = replace(newsletter, """", chr(34))
pcount = request.QueryString("pCount")
%>
<!--#include file="includes\connection.inc"-->
<%
'create the variables for the email to myself
dim objMail, MailMsg
'dimension the variables and set them
%>
<%
strSQL = "SELECT Email_Address FROM Mailing;"
set RS = conn.execute(strSQL)
arrEmail = RS.getrows
%>
<%
RS.close
set RS = nothing
conn.close
set conn = nothing
%>
<%
sub sendMail
Set objMail = Server.CreateObject("Persits.MailSender")
If pCount = 1 Then
for i = 0 to 500
'addresslist =
objMail.Host = "Mail.stevenscaife.co.uk"
objmail.From = "(e-mail address removed)"
objmail.fromname = "(e-mail address removed)"
objMail.addaddress arrEmail(0, i)
objMail.subject = "FINKA Newsletter"
objMail.isHTML = False
objMail.Body = newsletter
ObjMail.send
objMail.reset
next
'send emails
Set objMail = nothing
%>
<meta HTTP-EQUIV="refresh" content="0;url=process_newsletter.asp?pCount=2">
<%
Else
for i = 501 to ubound(arrEmail, 2) '501
'addresslist =
objMail.Host = "Mail.stevenscaife.co.uk"
objmail.From = "(e-mail address removed)"
objmail.fromname = "(e-mail address removed)"
objMail.addaddress arrEmail(0, i)
objMail.subject = "FINKA Newsletter"
objMail.isHTML = False
objMail.Body = newsletter
ObjMail.send
objMail.reset
next
'send emails
Set objMail = nothing
end if
response.write "<p class='maintext'>Emails have been sent</p>"
end sub
%>
And I call the sub in the body of my page, can anyone see anything wrong
with it that could cause it to not send text and to send to the email
address twice. The mailing list is approx 860 people long.
TIA
it worked fine. What happens is it sends two emails instead of one, and
also doesn't put any text in the email for some addresses. Its sent as
plain text and as i said when i tested it to 6 email addresses it worked
fine.
my code is below
<%@LANGUAGE="VBSCRIPT"%>
<% option explicit %>
<%
server.ScriptTimeout=300
response.buffer = true
dim newsletter, arrEmail, i, addresslist, pCount
newsletter = request.form("newsletter")
newsletter = replace(newsletter, "'", "''")
newsletter = replace(newsletter, """", chr(34))
pcount = request.QueryString("pCount")
%>
<!--#include file="includes\connection.inc"-->
<%
'create the variables for the email to myself
dim objMail, MailMsg
'dimension the variables and set them
%>
<%
strSQL = "SELECT Email_Address FROM Mailing;"
set RS = conn.execute(strSQL)
arrEmail = RS.getrows
%>
<%
RS.close
set RS = nothing
conn.close
set conn = nothing
%>
<%
sub sendMail
Set objMail = Server.CreateObject("Persits.MailSender")
If pCount = 1 Then
for i = 0 to 500
'addresslist =
objMail.Host = "Mail.stevenscaife.co.uk"
objmail.From = "(e-mail address removed)"
objmail.fromname = "(e-mail address removed)"
objMail.addaddress arrEmail(0, i)
objMail.subject = "FINKA Newsletter"
objMail.isHTML = False
objMail.Body = newsletter
ObjMail.send
objMail.reset
next
'send emails
Set objMail = nothing
%>
<meta HTTP-EQUIV="refresh" content="0;url=process_newsletter.asp?pCount=2">
<%
Else
for i = 501 to ubound(arrEmail, 2) '501
'addresslist =
objMail.Host = "Mail.stevenscaife.co.uk"
objmail.From = "(e-mail address removed)"
objmail.fromname = "(e-mail address removed)"
objMail.addaddress arrEmail(0, i)
objMail.subject = "FINKA Newsletter"
objMail.isHTML = False
objMail.Body = newsletter
ObjMail.send
objMail.reset
next
'send emails
Set objMail = nothing
end if
response.write "<p class='maintext'>Emails have been sent</p>"
end sub
%>
And I call the sub in the body of my page, can anyone see anything wrong
with it that could cause it to not send text and to send to the email
address twice. The mailing list is approx 860 people long.
TIA