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

CDONTS worked, now it doesn't! 1

Status
Not open for further replies.

streborr

IS-IT--Management
Jan 16, 2002
98
When I first ran this code it worked perfectly, now it doesn't work at all and I haven't changed anything.
I don't received any error messages, I just don't get the mail.
After a user logs in I want to receive an email telling me who logged in, when and what group they're in.

Am I missing something?

dim sMailBody
dim objMail
set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = "server"
objMail.To = "me@here.com"
objMail.bodyformat = cdoBodyFormatHTML
objMail.MailFormat = cdoMailFormatMIME
objMail.subject = "Database has been Accessed"
sMailBody = sMailBody & &quot;<HTML><HEAD><TITLE>Access Log</TITLE></HEAD>&quot;
sMailBody = sMailBody & &quot;<BODY><TABLE width=&quot;&quot;400&quot;&quot; border=&quot;&quot;1&quot;&quot; cellpadding=&quot;&quot;2&quot;&quot; cellspacing=&quot;&quot;0&quot;&quot;>&quot;
sMailBody = sMailBody & &quot;<TR><TH>Name</TH><TH>Date</TH><TH>Group</TH></TR>&quot;
sMailBody = sMailBody & &quot;<tr><td>&quot; & rsADO(&quot;user_name&quot;) & &quot;</td>&quot;
sMailBody = sMailBody & &quot;<td>&quot; & date() & &quot;</td>&quot;
sMailBody = sMailBody & &quot;<td>&quot; & rsADO(&quot;user_group&quot;) & &quot;</td>&quot;
sMailBody = sMailBody & &quot;</tr></table></body></html>&quot;
objMail.Body = sMailBody
objMail.Send
Set objMail = nothing


Thanks for ANY help!
Rick
 
I had this problem once... the sys admin had seen activity on the SMTP service, thought it was a security breach and shut off the service without telling me.

Could any settings have changed on your server?
 
JuanitaC,
Nothing on the server has changed.

Thanks,
Rick
 
Hmmm... now I am just shooting in the dark...

Are you sure that there are no errors? Try putting an error catch after your send, and after your object creator...

If Err<>0 then
Response.Write(&quot;Error is &quot; & Err.description & &quot;<br>&quot;)
Response.end
End if

And at the top of your page make sure you have
On Error Resume Next
 
Have you treid looking in the mailroot folder in IIS to see what the problem is because all emails go there first before being sent
 
This happened to me and I resolved the issue by assigning objMail.to to a variable rather than a string.
In other words declare that the variable mail_address = &quot;me@mycom.com&quot; and then set objMail = mail_address.
Hope this helps.
 
noelicus:
No luck with setting a variable

JuanitaC:
Didn't get any errors

Phonez:
I don't have access to the mailroot. It's running on a server at a host service.

Your responses are geatly appreciated,
keep 'em coming
Thanks,
Rick
 
Rick, I'd call your ISP and get them to tell you what's wrong with it. If you've changed nothing, then they have, and can probably tell you exactly what the problem is.

My suspicion is that they've implemented some new security measure to avoid spammers using their SMTP server, and neglected to tell any of their customers about it.

Just a guess, but like I said... if you've changed nothing, then they have.

:)
paul
penny1.gif
penny1.gif
 
I believe you may be right, link9.

I'll be giving them a call.

Thanks everyone for your input,
Rick
 
Is this syntax correct

objCDO.Send
If Err<>0 then
Response.Write(&quot;Error is &quot; & Err.description & &quot;<br>&quot;)
Response.end
End if Regards gsc1ugs
&quot;Cant see wood for tree's...!&quot;
 
gsc1ugs, that error message will work IF you have On Error Resume Next on your page somewhere above where you want to check for an error.
 
Can u give example Regards gsc1ugs
&quot;Cant see wood for tree's...!&quot;
 
<%
On Error Resume Next

'call stored procedure
Set rs = Server.createObject(&quot;ADODB.Recordset&quot;)
Set cmd = Server.createObject(&quot;ADODB.Command&quot;)
cmd.ActiveConnection = conn
cmd.CommandType=&quot;adCMDStoredProc&quot;
cmd.CommandText=&quot;sp_GetStuff&quot;

'execute stored procedure
set rs=cmd.Execute()

'check for errors
if Err<>0 then
Response.write(&quot;Error is &quot; & Err.description & &quot;<br>&quot;
Response.end
end if
%>

 
Is this relevant for CDONTS aswell Regards gsc1ugs
&quot;Cant see wood for tree's...!&quot;
 
You can use the If Err<>0 then... after any statement that might cause a runtime error. You can put it after object creation statements to make sure that your objects are created properly, etc. So, in the CDONTS example from above....

<%
On Error Resume Next

dim sMailBody
dim objMail
set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
'make sure Mail object created
if Err<>0 then
Response.write(&quot;Error is &quot; & Err.description & &quot;<br>&quot;)
Response.end
end if

'set properties/methods of Mail object
objMail.From = &quot;server&quot;
objMail.To = &quot;me@here.com&quot;
objMail.bodyformat = cdoBodyFormatHTML
objMail.MailFormat = cdoMailFormatMIME
objMail.subject = &quot;Database has been Accessed&quot;
sMailBody = sMailBody & &quot;here&quot;
objMail.Body = sMailBody
objMail.Send

'make sure that Send works properly
if Err<>0 then
Response.Write(&quot;Error is &quot; & Err.description & &quot;<br>&quot;)
Response.end
end if
Set objMail = nothing
%>
 
My final question... will this work with Microsoft Exchange server.... i cant start SMTP cause exchange is being used instead for web access.. will it still work the cdonts cause i aint getting any errors Regards gsc1ugs
&quot;Cant see wood for tree's...!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top