By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,306 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

problem with emailing code

P: n/a
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 = "ma*********@finka.co.uk"

objmail.fromname = "ma*********@finka.co.uk"

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 = "ma*********@finka.co.uk"

objmail.fromname = "ma*********@finka.co.uk"

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


Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.