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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASPmail to CDONTS

Status
Not open for further replies.

Anthony904

IS-IT--Management
Jul 15, 2004
153
US
I'm having a little problem trying to convert ASPmail to CDONTS

Could someone help me..

Code:
'set up mailer
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
MAILER.IgnoreMalformedAddress = true
if isnull(session("username")) then
	session("username") = "La Porte FMS"
elseif len(session("username")) < 1 then
	session("username") = "La Porte FMS"
end if
Mailer.FromName  = session("username")
if isnull(session("useremail")) then
	session("useremail") = "UNKNOWN"
elseif len(session("useremail")) < 1 then
	session("useremail") = "UNKNOWN"
end if
Mailer.FromAddress = session("useremail")

Mailer.RemoteHost = "swest.swz.dupont.com"
'Mailer.RemoteHost = "bmoa.swz.dupont.com"

Mailer.Subject = "DEATH IN FAMILY NOTICE " + formatdatetime(now(), vbShortDate)
rst.close
'add the distribution
set rst = dbcon.execute("SELECT * from DISTRIBUTION WHERE form = 'DIF' AND type = 'TO'")
while not rst.eof
	if len(rst("email")) > 0 then
		Mailer.AddRecipient rst("name"), rst("email")
	end if
	rst.movenext
wend
rst.close
set rst = dbcon.execute("SELECT * from DISTRIBUTION WHERE form = 'DIF' AND type = 'CC'")
while not rst.eof
	if len(rst("email")) > 0 then
		Mailer.AddCC rst("name"), rst("email")
	end if
	rst.movenext
wend
Mailer.BodyText = mt

Thanks for the help
 
Can I suggest not using CDONTS, use CDOSYS instead. The latest MS servers use it nowadays instead of CDONTS.

Steve Davis
ttf(a)HaHaHa.com.au

Me? I can't even spell ASP!

NOTE: This sig does not include any reference to voting, stars, or marking posts as helpful as doing so is cause for membership termination.
 
well.. the local server I'm on has been using CDONTS.. and I would rather use that for now.. so any help on that would be appreciated.

I will however look into your suggestion..

Thanks!
 
... this is just a guess but I've converted pages that were using CDONTS because they were originally developed back on Win NT 4.0 and were in continual use for years and since then the OS has been upgraded to Server 2000/2003
 
I did a little research and came up with this..

Please advise/correct as you see fit...



Set Mailer = Server.CreateObject("CDONTS.NewMail") 'Changed

' Don't understand this line
mailer.IgnoreMalformedAddress = true

if isnull(session("username")) then
session("username") = "LaPorte FMS"
elseif len(session("username")) < 1 then
session("username") = "LaPorte FMS"
end if

Do I need this section ???
Mailer.FromName = session("username")
if isnull(session("useremail")) then
session("useremail") = "UNKNOWN"
elseif len(session("useremail")) < 1 then
session("useremail") = "UNKNOWN"
end if

Mailer.From = session("useremail") 'Changed from FromAddress

'Do we need this section?
Mailer.RemoteHost = "swest.swz.dupont.com"

Mailer.Subject = "DISABILITY ABSENCE REPORT - PART A"
'add the distribution
set rst = dbcon.execute("SELECT * from DISTRIBUTION WHERE form = 'ABSENCE_RPT' AND type = 'TO'")
while not rst.eof
if len(rst("email")) > 0 then
Mailer.To rst("name"), rst("email") 'Changed from AddRecipient
end if
rst.movenext
wend
rst.close
set rst = dbcon.execute("SELECT * from DISTRIBUTION WHERE form = 'ABSENCE_RPT' AND type = 'CC'")
while not rst.eof
if len(rst("email")) > 0 then
Mailer.CC rst("name"), rst("email") 'Changed from AddCC
end if
rst.movenext
wend
rst.close
mysql = "SELECT * from PROVDISTRIBUTION WHERE form = 'ABSENCE_RPT' AND idForm = " + session("id")
rst.Open mysql, dbcon
while not rst.eof
if len(rst("email")) > 0 then
Mailer.To rst("name"), rst("email") 'Changed from AddRecipient
end if
rst.movenext
wend
Mailer.Body = mt 'Changed from BodyText
%>
<center>
<p><h2>DISABILITY ABSENCE REPORT - PART A</h2></p>
<%
if Mailer.Send then 'Changed from SendMail
%>Absence Report emailed to distribution.<br><%
else
%>Absence Report no EMailed failure. Error was&nbsp;<%=Mailer.Response%><br><%
end if
rst.close
dbcon.close
%>

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top