Solved

CDONTS.NewMail problem

Posted on 2002-05-21
16
208 Views
Last Modified: 2006-11-17
Hello,

I am attemtping to use CDONTS.NewMail in VBScript to send a mail but with no success. I have had a look at the Err object but it shows no problem.

Any ideas?

Thanks,
Paul.
0
Comment
Question by:paulhannon
  • 5
  • 4
  • 2
  • +3
16 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7024710
A few issues:

Make sure that the cdonts.dll is installed and registered on your server

SMTP services must be installed, configured correctly, and running on the SAME server as the ASP page. If not, try using CDO or some third party solution such as the free and excellent ASPeMail from www.persists.com.

If the above checks out and you are still having problems, please post your code.

Fritz the Blank
0
 

Author Comment

by:paulhannon
ID: 7024770
Is there anything in particular that i should look for when checking the config of the SMTP service?
0
 
LVL 11

Expert Comment

by:thunderchicken
ID: 7024790
Check your C:\inetpub\mailroot folder (queue, badmail) to see if it's really sending it.  If they are still in the queue, your code is fine, you'll just have to change your SMTP settings.  Badmail folder are for unreachable items, which you can open and check.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7024805
Try sending mail with that SMTP service via outlook or something like that. If it works, you should be in a good way.

Fritz the Blank
0
 

Author Comment

by:paulhannon
ID: 7024811
Yeah they are in the queue. Any idea what could be wrong in SMTP?
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7024841
Is the SMTP service starte dand configured correctly? (Look at the properties of the SMTP site within IIS Management Console)

CJ
0
 

Author Comment

by:paulhannon
ID: 7024880
Sorry, which params do you mean?
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 50 total points
ID: 7024900
No parameters, only the settings.

If the emails are in the queue it means that they are waiting to be sent, but they can only be sent if it knows the exchange server it has to send through. That means tha you have to configure your smtp service. You need to set, for example, the SMTP server it uses to send emails through. Without that set it won't know how to send the email.

Check that...

- Open IIS management console
- open up the treeview and somewhere it should say "SMTP ..."
- rightclick and open the properties. Check everything in there...

CJ
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:paulhannon
ID: 7024920
Right ok,

I have to get off now but tomorrow i'll check the required exchange server and get back to you.

Thanks a lot for your help,
Paul.
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7024955
Also, make sure you have a TO/FROM/SUBJECT for the e-mail. CDONTS is really picky about that. Your code can be fine, but if you didn't check for a blank to/from/subject, and one sneaks in, that mail won't be sent.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7024982
It is already in the queue, so that should be okay.

CJ
0
 
LVL 1

Expert Comment

by:raid999
ID: 7025872
I have a working example in ASP and then you can try to convert it to VBScript.

The form: index.asp
<%
' You can use this code in your own projects.

Response.Buffer = True
Response.ContentType = "text/html"
%>

<html>

<head>
<title>Send Mail</title>
</head>

<body>

<form method="POST" action="send.asp">
 
  <p>From: <input type="text" name="From" size="20"><br>
  To:&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" name="To" size="20"><br>
  Subject:<input type="text" name="Subject" size="20"></p>
  <p>Body:<textarea rows="2" name="Body" cols="20" style="float: left"></textarea></p>
  <p><input type="submit" value="Send" name="Send"></p>
</form>

</body>

</html>

and the file that sends the mail: send.asp

<%
' You can use this code in your own projects.

Response.Buffer = True
     if InStr(Request.ServerVariables("HTTP_ACCEPT"), "wml") then
       Response.ContentType = "text/vnd.wap.wml"
          Response.Write "<?xml version=""1.0""?><!DOCTYPE wml PUBLIC ""-//WAPFORUM//DTD WML 1.1//EN"" ""http://www.wapforum.org/DTD/wml_1.1.xml"">"
     else
          Response.ContentType= "text/html"
     end if
%>
    <%
     Dim JMail
     Set JMail = Server.CreateObject ("CDONTS.NewMail")
     With JMail
          .from = Request.form ("From")
          .to= Request.form ("To")
          .Subject = Request.form ("Subject")
          .Body = Request.Form("Body") + vbCrLf + vbCrLf + _
                "______________________________________________________" + vbCrLf + _
                " Message sent via Raid's WAPMail "  + vbCrLf + _
                " http://80.195.36.75/c"
    On Error Resume Next
          .send
     End With
     Set Jmail = Nothing

    Dim Report
     If Err <> 0 Then
          Report = "Error: " & Err.Description
     Else
          Report = "Message sent to " & Request.form("To")
     End If
     
     if Request.form("To")="" then
          Report = "Nothing sent"
     end if
    %>
<% if InStr(Request.ServerVariables("HTTP_ACCEPT"), "wml") then %>

<wml>
  <card title="Raid's WAP Mail">
    <p>
      <%= Report %>
      <br/>
      <br/>
      <a href="wap.asp#Send">Send another</a>
    </p>
    <p>
      <small>© 2002, Al lawati</small>
    </p>
  </card>
</wml>
<%else%>
<HTML>
     <TITLE>WAP Mail by Raid</TITLE>
          <BODY>
               <%= Report %>
          </BODY>
</HTML>
<%end if%>












0
 
LVL 11

Expert Comment

by:thunderchicken
ID: 7025950
The code isn't the problem, if it's in the queue, it's fine.
0
 
LVL 1

Expert Comment

by:raid999
ID: 7026242
Right, i am sorry i didnt read that part sorry again
0
 

Author Comment

by:paulhannon
ID: 7026579
Hello again,

Got in this morning to about 100 emails from CDONTS. Looks like it may have been a problem interfacing with our exchange server becuase it works straight away now.

Thanks to everyone for the help.

Paul.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7026598
Glad that it is solved!
 Thnx for the A
CJ
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now