Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASPMailer Not Sending Email

Status
Not open for further replies.

jaslr

Programmer
Aug 16, 2001
67
AU
Howdy, I'm having a lot of trouble with my aspmailer which I use to send a form as an email through our internal email server. As far as I can see the asp works fine right up until it needs to send the email. I've trialled it with various email destinations and on both our wan and my local webserver.

What happens: User goes to test.asp and fills out their name and does the test. They press 'submit' which sends the information to aspmailer.asp (which I can see is working because the url redirect works) however the data is not being sent to the webserver.

Any idea why this form isn't working?

Here is my complete (form code) of test.asp . P.S. It's a medical test just fyi.

Code:
<form name="quiz" action="aspmailer.asp" method="POST">
	  <!-- If you want to change who the email is sent to once the "Submit" Button is pressed go to the above file (currently ../cgi-bin/aspmailer.asp and look for the line "strRcpt = "someone@something.org.au" 'Put the address you want the form sent to here" and change someone@something.org.au to the desired target email address.-->

<!--fields used to direct asp script actions-->

<!--TGrequire: fields that must have input [OPTIONAL]-->
<input type="hidden" name="TGrequire" value="Name: ">



<!--TGorder: order in which inputs should appear in email [OPTIONAL]-->
<input type="hidden" name="TGorder" value="Name: ,PayCode: ,Department: ,Test Number: ,Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11,Q12,SCORE,Out Of: ">	

<!--TGsubject: Subject line of email [OPTIONAL]-->
<input type="hidden" name="TGsubject" value="Someone has completed the Online Nursing Maths Test">

<!--TGredirect: URL browser can be redirected to on successful submission [OPTIONAL]-->
<input type="hidden" name="TGredirect" value="">
<input type="hidden" name="Out Of: " value="12">
<input type="hidden" name="Test Number: " value="2">
  <hr>
    <div align="left"> 
     

	  <table width="85%" border="0">
        <tr>
          
        <td height="2178"> 
          <div align="left"> 
              <table width="80%" border="0" cellpadding="0">
                <tr> 
                  <td class="body" colspan="2" bgcolor="#C9E4E4"> 
                    <p><font color="#CC6633" face="Geneva, Arial, Helvetica, san-serif"></font></p>
                  </td>
                </tr>
                <tr> 
                  <td class="body" width="25%"> 
                    <div align="right"><font face="Georgia, Times New Roman, Times, serif"><b> 
                      Name: </b></font></div>
                  </td>
                  
                <td class="body" width="75%">
                  <input name="Name: " size="30" onFocus="if(disabled)blur();">
                </td>
                </tr>
                <tr> 
                  <td class="body" width="25%"> 
                    <div align="right"><font face="Georgia, Times New Roman, Times, serif"><b> 
                      PayCode: </b></font></div>
                  </td>
                  
                <td class="body" width="75%"> 
                  <input type="text" name="PayCode: " size="12">
                  </td>
                </tr>
                <tr> 
                  <td class="body" width="25%"> 
                    <div align="right"><font face="Georgia, Times New Roman, Times, serif"><b>Department</b></font></div>
                  </td>
                  <td class="body" width="75%"> 
                                     </td>
                </tr>
                <tr> 
                  <td class="body" colspan="2" bgcolor="#C9E4E4"></td>
                </tr>
                <tr> 
                  <td class="body" colspan="2"> 
                    <p>PLEASE COMPLETE THE FOLLOWING QUESTIONS CALCULATORS MAY 
                      BE USED TO CHECK ANSWERS CHOOSE THE CORRECT FORMULA AND 
                      ANSWER. </p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                  </td>
                </tr>
              </table>
              
            <p align="center"><b><font color="#990000" face="Georgia, Times New Roman, Times, serif">Please 
              enter your name BEFORE starting the test.</font></b></p>
            <p align="center"><font color="#990000"><b><font face="Georgia, Times New Roman, Times, serif">Please 
              do not print this test.<font size="2"></font></font></b></font></p>
            <p><a href="formulas.jpg" onMouseDown="MM_openBrWindow('formulas.jpg','Formulas','width=607,height=380')" target="_new">Click 
              Here for Formulas</a></p>

			  
            <br> 

      
            <p><b>1. Thyroxine is prescribed to be given 150 micrograms daily.Tablets 
              are available in 0.05 mgs.How many tablets do you give?</b><br>

			  <input type="radio" name="Q1" onClick="this.form['Name: '].disabled=true"; Q1.value="A" VALUE="5">
              a) 5<br>
			  <input type="radio" name="Q1" onClick="this.form['Name: '].disabled=true"; Q1.value="B" VALUE="2">
              b) 2<br>
			  <input type="radio" name="Q1" onClick="this.form['Name: '].disabled=true"; Q1.value="*" VALUE="* 3">
              c) 3<br>
			  <input type="radio" name="Q1" onClick="this.form['Name: '].disabled=true"; Q1.value="D" VALUE="1/3">
              d) <img src="formula02.jpg" width="13" height="18"> </p>
            </div>
            <p>&nbsp; 
            <p align="left"><b> 2. Digoxin 0.125 mg is ordered to be given orally.Tablets 
              available are 62.5 micrograms.How many tablets do you give?</b><br>
              <input type="radio" name="Q2" VALUE=" * 2" onClick=Q2.value="*">
              a) 2<br>
              <input type="radio" name="Q2" VALUE="1" onClick=Q2.value="B">
              b) 1<br>
              <input type="radio" name="Q2" VALUE="1/2" onClick=Q2.value="C">
              c) &frac12;<br>
              <input type="radio" name="Q2" VALUE="4" onClick=Q2.value="D">
              d) 4 
            <p align="left"><b>3. A child weighing 10 kgs has been ordered Phenergan 
              elixir 0.5 mgs per kg bodyweight. The drug is available as 5 mgs 
              in 5 mls.How much mixture would you give?</b><br>
              <input type="radio" name="Q3" VALUE="2.5" onClick=Q3.value="A">
              a) 2.5<br>
              <input type="radio" name="Q3" VALUE="10" onClick=Q3.value="B">
              b) 10<br>
              <input type="radio" name="Q3" VALUE="1" onClick=Q3.value="C">
              c) 1<br>
              <input type="radio" name="Q3" VALUE="* 5" onClick=Q3.value="*">
              d) 5 
            <p align="left"><b>4. Mr chesty is ordered Atropine 0.4 mgs IMI as 
              part of his Pre medication.The ampoule contains 1200 micrograms 
              per ml.What volume would you give?</b><br>
              <input type="radio" name="Q4" VALUE="* 1.2" onClick=Q4.value="*">
              1.2<br>
              <input type="radio" name="Q4" VALUE="3" onClick=Q4.value="B">
              3<br>
              <input type="radio" name="Q4" VALUE="0.3" onClick=Q4.value="C">
              0.3 <br>
              <input type="radio" name="Q4" VALUE="0.4" onClick=Q4.value="D">
              0.4 
            <p align="left">&nbsp; 
            <p align="left"><b>5. 500 mls of IVI fluid is to be given over 2 hours.The 
              IV giving set delivers 20 drops per ml (macro set)How many drops 
              per minute should you count?</b><br>
              <input type="radio" name="Q5" VALUE="* 84" onClick=Q5.value="*">
              84<br>
              <input type="radio" name="Q5" VALUE="125" onClick=Q5.value="B">
              125<br>
              <input type="radio" name="Q5" VALUE="250" onClick=Q5.value="C">
              250 <br>
              <input type="radio" name="Q5" VALUE="42" onClick=Q5.value="D">
              42 
            <p align="left"><b>6. The micro infusion set delivers 60 drops of 
              fluid per ml.1000 mls of fluid is to be given over 6 hour.How many 
              drops per minute are counted?</b><br>
            <p align="left"> 
              <input type="radio" name="Q6" VALUE="60" onClick=Q6.value="A">
              60 <br>
              <input type="radio" name="Q6" VALUE="* 84" onClick=Q6.value="*">
              84<br>
              <input type="radio" name="Q6" VALUE="167" onClick=Q6.value="C">
              167<br>
              <input type="radio" name="Q6" VALUE="12" onClick=Q6.value="D">
              12 
            <p align="left"><b>7. A patient is ordered 1.8 gms of IVI benzylpenicillin.The 
              vial contains 3 grams. Using the scale provided, calculateHow many 
              mls of solution you will administer to the patient.All 3 alternative 
              answers are provided.</b></p>
            <p align="center"><b><img src="formula01.jpg" width="374" height="48"></b></p>
            <p align="left"> 
              <input type="radio" name="Q7" VALUE="10, 9, 3mls" onClick=Q7.value="A">
              10, 9, 3mls<br>
              <input type="radio" name="Q7" VALUE="15, 10, 6 mls" onClick=Q7.value="B">
              15, 10, 6 mls<br>
              <input type="radio" name="Q7" VALUE="18, 13, 8 mls" onClick=Q7.value="C">
              18, 13, 8 mls<br>
              <input type="radio" name="Q7" VALUE="* 12, 9, 6mls" onClick=Q7.value="*">
              12, 9, 6mls</p>
            <p align="left">&nbsp; 
            <table width="100%" border="0">
              <tr> 
                <td bgcolor="#CCCCCC">&nbsp;</td>
              </tr>
            </table>
            <p align="left">&nbsp; 
            <p align="center"><b>Policy questions</b></p>
            <p><b><a href="[URL unfurl="true"]http://sandocs.sah.com/toc_section.asp?Dept=PHA&Manual=DRG&Section=all"[/URL] target="_new">Click 
              Here for the Pharmacy Drug Therapy Manual</a></b></p>
            <p align="left">&nbsp;
            <p align="left"><b>Choose the correct answer for each abbreviation:</b> 
            <blockquote> 
              <table width="100%" border="0">
                <tr> 
                  <td width="28%"><b>8.)</b> p.c. </td>
                  <td width="62%"> 
              <input type="radio" name="Q8" VALUE="before meals" onClick=Q8.value="A">
                    before meals 
              <input type="radio" name="Q8" VALUE="* after meals" onClick=Q8.value="*">
                    after meals
              <input type="radio" name="Q8" VALUE="after medication" onClick=Q8.value="C">
                    after medication
              <input type="radio" name="Q8" VALUE="before medication" onClick=Q8.value="D">
                    before medication
					</td>
                  <td width="10%">&nbsp;</td>
                </tr>
                <tr> 
                  <td width="28%"><b>9.)</b> qid</td>
                  <td width="62%"> 
              <input type="radio" name="Q9" VALUE="* 4 times a day" onClick=Q9.value="*">
                    4 times a day 
              <input type="radio" name="Q9" VALUE="every 4 hours" onClick=Q9.value="B">
                    every 4 hours
              <input type="radio" name="Q9" VALUE="every 2 hours" onClick=Q9.value="C">
                    every 2 hours
              <input type="radio" name="Q9" VALUE="2 times a day" onClick=Q9.value="D">
                    2 times a day</td>
                  <td width="10%">&nbsp;</td>
                </tr>
                <tr> 
                  <td width="28%"><b>10.) </b> o.d.</td>
                  <td width="62%"> 
              <input type="radio" name="Q10" VALUE="* every day" onClick=Q10.value="*">
                    every day 
              <input type="radio" name="Q10" VALUE="oral drops" onClick=Q10.value="B">
                    oral drops
              <input type="radio" name="Q10" VALUE="overdose" onClick=Q10.value="C">
                    overdose
              <input type="radio" name="Q10" VALUE="discontinued" onClick=Q10.value="D">
                    discontinued</td>
                  <td width="10%">&nbsp;</td>
                </tr>
              </table>
            </blockquote>
            <p align="left"><br>
            <p align="left"><b>11. You are asked to deliver 1000 mls of Dextrose 
              saline IVI with 40 mmols of Potassium chloride over 12 hours.Your 
              patient has a central line. Do you require an infusion pump?</b><br>
             <p align="left"> 
              <input type="radio" name="Q11" VALUE="*">
              yes<br>
              <input type="radio" name="Q11" VALUE="">
              no <br>
              <input type="radio" name="Q11" VALUE="">
              only for elderly patients<br>
              <input type="radio" name="Q11" VALUE="">
              not for obstetric patients<br>
            <p align="left">&nbsp; 
            <p align="left"> <b>12</b>,<b> Choose the SAH approved drug references 
              to confirm correct medication administration.</b><br>
            <p align="left"> 
              <input type="radio" name="Q12" VALUE="Pharmacist, NUM" onClick=Q12.value="A">
              Pharmacist, NUM<br>
              <input type="radio" name="Q12" VALUE="MIMS, Senior RN" onClick=Q12.value="B">
              MIMS, Senior RN <br>
              <input type="radio" name="Q12" VALUE="Pharmacist, CMO" onClick=Q12.value="C">
              Pharmacist, CMO <br>
              <input type="radio" name="Q12" VALUE="* MIMS, gold book, pharmacist,drug insert." onClick=Q12.value="*">
              MIMS, gold book, pharmacist,drug insert. 
            
          <p align="left"><font color="#990000"><b><font size="4">Please make 
            sure you have entered your Name and Paycode Before Sending Results</font><br>
            </b></font><br>
          <table border="0" align="center">
            <tr> 
              <td valign="middle"> 
                <input type="button" value="Score Quiz" onClick=scorequiz(this.form) name="button">
              </td>
              <td valign="bottom"><a href="#top"><img src="reviewTest.jpg" width="83" height="24" border="0"></a></td>
            </tr>
          </table>
          <p align="center">
            <center>
              <p><B>Your Quiz Score is </B> 
                <INPUT  NAME="SCORE" TYPE="text" maxlength="2" size="5" READONLY>
              <b> out of 12</b></p>
              
            <p> 
             <input type="submit" value="Submit Test" name="submit">
            </p>
            </center>
            <p> 
              <center>
              </center>
          </td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </div>
    
  <p>&nbsp; 
</FORM>





And here is the aspmailer.asp

Code:
<%@language = "VBscript"%>
<%
'Tom Germain's Standard Cgiware Global Variables and set-up
'DO NOT REMOVE THIS SECTION OR NOTHING WILL WORK
Dim strError
Response.Buffer = True 
If ScriptEngineMajorVersion < 2 Then
ReportError "Host system needs scripting engine upgrade to use this script"
End If
Set objFM = CreateObject("Scripting.Dictionary")
If IsObject(objFM) = False Then
ReportError "Host system lacks component(s) required by this script"
End If
Set objMailx = CreateObject("CDONTS.Newmail")
If IsObject(objMailx) = False Then
ReportError "Host system lacks component(s) required by this script"
End If
Set objMailx = Nothing
%>
<%
'aspmailer.asp by Tom Germain, Copyright 1998-2004
'Version 1.0
'cgiwaresoftware@yahoo.com
'Visit [URL unfurl="true"]http://www.cgiware.com[/URL] for latest version, documentation, and other resources
'This is freeware - Use at your own risk. No warranties provided.
'Redistribution of this program, in whole or in part, is strictly
'prohibited without the expressed written consent of the author.
'Custom programming available on hourly fee basis.
%>

<%'variables you can set start here%>
<%
strRcpt = "myemailaddress@me.com" 'Put the address you want the form sent to here

strFromVar = "" 'If you want a reply-to email address to be taken from the form
' put the name of the input item here. 

strDefFrom = "User" 'Put a default, even fake, From address here

strDefSubject = "Form submitted" 'Put the subject of the letter here. If an input item called
'subject exists in the form, its value will be used instead.

strRedirect = "formsubmitted.html" 'Url to redirect to after a successful form submission. If an input item called
'redirect exists in the form, its value will be used instead.

%>
<%'variables you can set end here%>

<%
ParseForm
CheckForm
If Len(strError) > 0 Then
ReportError strError
End If
strOutX = SeqForm
If Len(strOutX) < 1 Then 
 strOutX = FormToString
End If
If Len(strOutX) < 1 Then 
ReportError "Submitted form is empty"
End If
strSubject = strDefSubject
If objFM.Exists("TGsubject") Then
strSubject = objFM.Item("TGsubject")
End If
strFrom = strDefFrom
If Len(strFromVar) > 0 Then 
If objFM.Exists(strFromVar) Then strFrom = objFM.Item(strFromVar) End If 
End If
SendMail strFrom,strRcpt,strSubject,strOutX
If Len(strRedirect) > 0 Then
 Response.redirect(strRedirect)
 Response.End
End If
If objFM.Exists("TGredirect") = True Then
If Len(objFM.Item("TGredirect")) > 0 Then 
Response.redirect(objFM.Item("TGredirect"))
Response.End
End If
End If
%>

<!--*******SUCCESSFUL SUBMISSION RESPONSE - START*******-->
<!--ADD YOUR OWN HTML TOP SECTION STARTING HERE-->
<h1>Form Sent!</h1>
Your request has been received and will be processed shortly.
<!--ADD YOUR OWN HTML TOP SECTION UP TO HERE-->
<!--*******SUCCESSFUL SUBMISSION RESPONSE - END********-->

<%
Credit
Response.End
%>
<%
Function IsValidEmail(Email)
Dim Temp,Temp2
strNotValid =  "<br>Email address not valid"
strTooLong =  "<br>Email address too long"
If Len(Email) > 100 Then
ReportError strTooLong
End If
Email = LCase(Email)
Temp = Split(Email,"@",2,1)
If UBound(Temp) < 1 Then
ReportError strNotValid
End If
Temp2 = Split(Temp(1),".",-1,1)
If UBound(Temp2) < 1 Then
ReportError strNotValid
End If
End Function
%>
<%
Function SendMail(From,Rcpt,Subject,Body)
Trim(From)
Trim(Rcpt)
If Len(From) < 1 Then  
ReportError strError & "<br>No Reply-to address (From) for this letter"
End If
If Len(Rcpt) < 1 Then
ReportError strError & "<br>No recipient for this letter"
End If
IsValidEmail Rcpt
IsValidEmail From
Set objMailer = CreateObject("CDONTS.Newmail")
objMailer.From = From
objMailer.To = Rcpt
objMailer.Subject = Subject
objMailer.Body = Body
objMailer.Send
Set objMailer = Nothing
End Function
%>
<%
Function CheckForm()
Dim Temp,strTmp,strForce
strInputReq =  "<br>Input required for "
If objFM.Exists("TGrequire") = False Then
 Exit Function
  ElseIf isEmpty(objFM.Item("TGrequire")) Then
   Exit Function
End If
strForce = objFM.Item("TGrequire")
Temp = Split(strForce,",",-1,1)
For Each strTmp in Temp
 If objFM.Exists(strTmp) = False Then
  strError = strError & strInputReq & strTmp
   ElseIf Len(objFM.Item(strTmp)) < 1 Then
    strError = strError & strInputReq & strTmp
 End If 
Next
End Function
%>
<%
Function ParseForm()
For Each Item in Request.Form
 If objFM.Exists(Item) Then
  objFM.Item(Item) = objFM.Item(Item) & "," & Request.QueryString(Item)
   Else 
    objFM.Add Item,Request.Form(Item)
 End If
Next
For Each Item in Request.QueryString
 If objFM.Exists(Item) Then
  objFM.Item(Item) = objFM.Item(Item) & "," & Request.QueryString(Item)
   Else 
    objFM.Add Item,Request.QueryString(Item)
 End If
Next
End Function
%>
<%
Function SeqForm()
Dim Temp,strTmp,strOrder,strOut
If objFM.Exists("TGorder") = False Then
 Exit Function
  ElseIf isEmpty(objFM.Item("TGorder")) Then
   Exit Function
End If
strOrder = objFM.Item("TGorder")
Temp = Split(strOrder,",",-1,1)
For Each strTmp in Temp
 If objFM.Exists(strTmp) Then
  strOut = strOut & strTmp & "=" & objFM.Item(strTmp) & Chr(10)
 End If 
Next
SeqForm = strOut
End Function
%>
<%
Function FormToString()
Dim strOut
strKeys = objFM.Keys
strValues = objFM.Items
For intCnt = 0 To objFM.Count -1
  strOut = strOut & strKeys(intCnt) & "=" & strValues(intCnt) & Chr(10)
Next
FormToString = strOut
End Function
%>
<%
Function ReportError(strMess)
If Len(strMess) < 1 Then
strMess = strError
End If
strErr = "The following error(s) happened: <br>" & strMess
Response.Clear
%>

<!--*******ERRONEOUS SUBMISSION RESPONSE - START*******-->
<!--ADD YOUR OWN HTML TOP SECTION STARTING HERE-->
<h1>Error!</h1>
<!--ADD YOUR OWN HTML TOP SECTION UP TO HERE-->

<%'Error messages will be output here, between your html%>
<%
Response.Write(strErr)
%>

<!--ADD YOUR OWN HTML BOTTOM SECTION STARTING HERE-->
<p>
<b>Click on you browser's <i>Back</i> button to correct any mistakes in your input</b>
</p>
<!--ADD YOUR OWN HTML BOTTOM SECTION UP TO HERE-->
<!--******ERRONEOUS SUBMISSION RESPONSE - END*******-->

<%
Credit
Response.End
End Function
%>

<%Function Credit%>
<!--START OF CREDIT - DO NOT CHANGE OR REMOVE ANYTHING BELOW THIS LINE-->
<p align=center>
<font face="Arial,Helvetica" size=1>
Mailer software is freeware by 
<a href="[URL unfurl="true"]http://www.cgiware.com/"[/URL] target="_top">CGIware</a> &nbsp;
<a href="[URL unfurl="true"]http://www.cgiware.com/"[/URL] target="_top"><img src="[URL unfurl="true"]http://www.cgiware.com/powered.gif"[/URL]  align="absmiddle" border="0"></a>
</font>
</p>
<!--END OF CREDIT-->
<%End Function%>
 
what type of server are you running? if it's 2003 you need to use cdo not cdonts. cdonts is not used anymore except in older sys. ensure active x controls are enabled too.

Good luck

BSL
 
thanks for the reply bslintx however now I'm getting this error:

Code:
Microsoft VBScript runtime error '800a01ad' 

ActiveX component can't create object: 'CDO.Newmail'
 
and by active x controls being enabled you mean on the server of course?
 
thanks for your help CDO, I'm currently perusing your very good link and realising that this freeware script is WAY old. Time for an upgrade. Thanks for your help and for helping me understand logically why it just stopped working - I hadn't known they had upgraded.
 
here is an example of cdosys

Code:
' requires mailserver,username,and password
function SendCdoMail(From,Rcpt,Subject,Body,sserver,suser,spass)

Set objCDO = Server.CreateObject("CDO.Message")

objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = sserver
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")[/URL] = 1
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusername")[/URL] = suser
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendpassword")[/URL] = spass
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpusessl")[/URL] = False
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")[/URL] = 60
objCDO.Configuration.Fields.Update

objCDO.To = Rcpt
objCDO.From = From

objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

Set objCDO = Nothing
end function
 
ok, thanks steven so this requires me to make a new email account that I can use with this form?
 
no it just requires you to input you outgoing mailserver, username, and password. Basicly the settings you would use to setup you outlook/outlook express account
 
some servers don't require authentication, so first try this and see if it works

Code:
function SendCdoMail(From,Rcpt,Subject,Body)

Set objCDO = Server.CreateObject("CDO.Message")

objCDO.To = Rcpt
objCDO.From = From

objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

Set objCDO = Nothing
end function

if it doesn't work then you need to use the first method i said, once one of then work, you can integrate it into your code by pasting the function somewhere on you can then find this line, and comment it, replace with the new
Code:
'SendMail strFrom,strRcpt,strSubject,strOutX
SendCdoMail strFrom,strRcpt,strSubject,strOutX
 
woah, that's WAY over my head. All this code pasting, I have NO idea where to put it and how it's related to my existing code and where in the new code is it calling the form information.
 
k first lets test the mailer create a page called testmail.asp

paste this in

just complete the variables

Code:
<%
strFrom=
strRcpt=
strSubject="subject test"
strOutX="body test"

function SendCdoMail(From,Rcpt,Subject,Body)

Set objCDO = Server.CreateObject("CDO.Message")

objCDO.To = Rcpt
objCDO.From = From

objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

Set objCDO = Nothing
end function

SendCdoMail strFrom,strRcpt,strSubject,strOutX

response.write "sent, check the mail"
%>

if this doesn't work then we need to all the code from above with the one below, and fill in the blanks
Code:
<%
strFrom=
strRcpt=
strSubject="subject test"
strOutX="body test"
strserver=
struser=
strpass=

function SendCdoMail(From,Rcpt,Subject,Body,sserver,suser,spass)

Set objCDO = Server.CreateObject("CDO.Message")

objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = sserver
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")[/URL] = 1
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusername")[/URL] = suser
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendpassword")[/URL] = spass
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpusessl")[/URL] = False
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")[/URL] = 60
objCDO.Configuration.Fields.Update

objCDO.To = Rcpt
objCDO.From = From

objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

Set objCDO = Nothing
end function


SendCdoMail strFrom,strRcpt,strSubject,strOutX,strserver,struser,strpass

response.write "sent, check the mail"
%>
 
name...btw...it was never mentioned...but what type of server are you runnng? stevens code is right on and you can also put in the ip address instead of server name

we'll be tracking your progress...hang in there ;-)

BSL
 
we're using windows 2003 server, thank you so much steven for your articulation on things I couldn't understand. However, since I'm in a microsoft exchange environment I have no way of finding out the address for our mail server and I am not willing to go through the gruelling explanation of WHY i need to know with our nazi network admin.
 
did you try the version that didn't require authentication. also most mailer servers are in this form

server=mail.yourdomainname.com
username=youremail@yourdomainname.com
password=youremailpassword
 
yes steven I did try the non authentication process first. What I've done now.

I'm using THIS code:

Code:
<%
strFrom="Nursing Maths Test"
strRcpt="me@myemail.com"
strSubject="subject test"
strOutX="body test"
strserver="femail"
struser="me@myemail.com"	
strpass="welcome"

function SendCdoMail(From,Rcpt,Subject,Body,sserver,suser,spass)

Set objCDO = Server.CreateObject("CDO.Message")

objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = sserver
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")[/URL] = 1
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusername")[/URL] = suser
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendpassword")[/URL] = spass
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpusessl")[/URL] = False
objCDO.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")[/URL] = 60
objCDO.Configuration.Fields.Update

objCDO.To = Rcpt
objCDO.From = From

objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

Set objCDO = Nothing
end function


SendCdoMail strFrom,strRcpt,strSubject,strOutX,strserver,struser,strpass

response.write "sent, check the mail"
%>

and get this error

Code:
error '80040211' 
Unable to obtain the Windows directory 

/cgi-bin/testmail.asp, line 37


if I DO NOT put the @myemail.com after my username I get this

Code:
error '8004020e' 
Unable to find a trustee name that corresponds to a security identifier provided by the user 

/cgi-bin/testmail.asp, line 37

...so as far as my limited knowledge stretches, it's saying it can find the email server it just can't send. Which is +1 where I was before.
 
is sserver the name of your smtp server? if not then there's one problem. if you use outlook go under options and find the name of you mail server and you could do a start>run>cmd> prompt>>nslookup <servername> and get the ip address
 
yes the sserver is the name of our smtp mail server (internal) any hint what to do next?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top