Solved

CDONTS.NewMail problem

Posted on 2002-05-21
16
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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
 

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get hold of longitude and latitude in iframe string 11 60
key press alert 2 46
Help with Classic ASP - Parameterizing Query 16 63
Split on ASP 8 49
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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

737 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