• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

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.
0
paulhannon
Asked:
paulhannon
  • 5
  • 4
  • 2
  • +3
1 Solution
 
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
 
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
CJ_SCommented:
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
 
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

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 5
  • 4
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now