CDONTS.NewMail problem

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.
paulhannonAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
CJ_SConnect With a Mentor Commented:
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
 
fritz_the_blankCommented:
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
 
paulhannonAuthor Commented:
Is there anything in particular that i should look for when checking the config of the SMTP service?
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
thunderchickenCommented:
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
 
fritz_the_blankCommented:
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
 
paulhannonAuthor Commented:
Yeah they are in the queue. Any idea what could be wrong in SMTP?
0
 
CJ_SCommented:
Is the SMTP service starte dand configured correctly? (Look at the properties of the SMTP site within IIS Management Console)

CJ
0
 
paulhannonAuthor Commented:
Sorry, which params do you mean?
0
 
paulhannonAuthor Commented:
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
 
webwomanCommented:
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
 
CJ_SCommented:
It is already in the queue, so that should be okay.

CJ
0
 
raid999Commented:
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
 
thunderchickenCommented:
The code isn't the problem, if it's in the queue, it's fine.
0
 
raid999Commented:
Right, i am sorry i didnt read that part sorry again
0
 
paulhannonAuthor Commented:
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
 
CJ_SCommented:
Glad that it is solved!
 Thnx for the A
CJ
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.