Solved

CDONTS.NewMail problem

Posted on 2002-05-21
16
207 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

9 Experts available now in Live!

Get 1:1 Help Now