Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with a mailing list

Status
Not open for further replies.

mtarby

Programmer
Feb 19, 2003
89
US
I had an asp mailing list that sent a message to a text file of recipients, which worked beautifully until the powers that be upgraded servers on me and didn't tell me how my components would be effected.

Anyway, now that I've vented...

This code is now throwing an error:

Code:
last = Ubound(maillist) - 1
Response.Write "<PRE>Mail being sent ot subscribed members of " & Request.Form("filename") & vbCrlf
Response.Write "using letter " & Request.Form("lfilename") & vbCrlf & vbCrlf
for i = 0 to last
singlemail = split(maillist(i), delimiter, -1, vbtextcompare)
if mailpattern(singlemail(0)) then
mailresult = SendMail(Request.Form("from"), singlemail(0), _
Request.Form("subject"), lettext, "", "", 1)
if mailresult then
Response.Write singlemail(0) & ": SENT" & vbCrlf
else
Response.Write singlemail(0) & ": MAIL NOT SENT"
end if
end if
next

This now gives me Microsoft VBScript runtime error '800a01c2' Wrong number of arguments or invalid property assignment: 'SendMail'

I did have to modify the SendMail function - but I can't tell where I caused the problem:

Code:
function  SendMail (sFrom, sTo, sSubject, sBody)
on error resume next
dim myCDO
set myCDO = Server.CreateObject("Persits.MailSender")
myCDO.Host = "mx1.lemoyne.edu"

if IsObject(myCDO) then
myCDO.From = sFrom
myCDO.AddAddress = sTo
myCDO.Subject = sSubject
myCDO.Body = sBody
myCDO.Send 
set myCDO = nothing
sendMail = True
else
SendMail = False
end if
on error goto 0
end Function

Any suggestions would be much appreciated!

Michelle
 
2 choices really,

install the Persists email component or re-write the SendMail function to use CDOSYS thread333-914290



Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
What OS is running on the new servers? It's possible that the Mail object needs to be changed to a different one like CDOSYS or CDONTS for example.

Tony
________________________________________________________________________________
 
We moved to a Windows 2003 box. The script originally used CDONTS - that was the first modification I had to make this morning was to migrate to the Persits component, which is installed. (Our network guy doesn't like CDONTS so he shut it down!)
 
CDONTS is best kept to NT and Win2K servers. I would suggest following Chris's example and using CDOSYS

Tony
________________________________________________________________________________
 
Unfortunately, Persits is the only option I have, so I guess I'll keep muddling along and try to figure it out.
 
CDOSYS should be installed on your system already as a built-in windows component. If you want to test that it is on the system write a quick test script (or copy the one I am about to paste here :p):
Code:
<%
'CDOSYS Example
Dim objCdoSys, cdoConf, cdoFlds
Set objCdoSys = Server.CreateObject("CDO.Message")
Set cdoConf = Server.CreateObject("CDO.Configuration")

set cdoFlds = cdoConf.Fields
With cdoFlds
	'send using: 
	'	1: Default, use server defined SMTP server
	'	2: Use te SMTP Server I am going to define
	.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
	'smtpserver: the address of the SMTP server you want to send through
	.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "mail.mydomain.com"
	.Update
End With

Set objCdoSys.Configuration = cdoConf
objCdoSys.From = "myName@myDomain.com"
objCdoSys.To = "someone@someOtherDomain.com"

objCdoSys.Subject = "This is my subject line"
objCdoSys.TextBody = "This is the body of my message"
'It isn't necessary to set the importance, this is just an additional example of
'	how easy it is to set all the fields using this component
objCdoSys.Fields("urn:schemas:httpmail:importance").Value = 1
objCdoSys.Fields.Update()
objCdoSys.Send()

Set objCdoSys = Nothing
%>

With some minor alterations you could use that script to send yourself an email (as a test). Every time i have to write an emnail page i generally copy something remarkably similar to that little script and then just fill it out as needed. Takes just a couple minutes to write a contact form :)

-T

barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top