Hello I am a asp newbie trying to send an notification email and update an access database at the same time. My database is being updated but the email portion is not working- the email portion is in php- Can I call it from my asp page and if so how/where:

my php page is contactusprocess.php

My ASP code is:

<!--#include file="Connections/InformationRequested2.asp" -->
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
If (CStr(Request("MM_insert")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_InformationRequested2_STRING
    MM_editCmd.CommandText = "INSERT INTO [Contact Us] (Message, [Bank Name], [First Name], [Last Name], [Phone Number], Email) VALUES (?, ?, ?, ?, ?, ?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 201, 1, -1, Request.Form("Message")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, 255, Request.Form("Bank Name")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 201, 1, 255, Request.Form("First Name")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1, 255, Request.Form("Last Name")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, 255, Request.Form("Phone Number")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 201, 1, -1, Request.Form("Email Address")) ' adLongVarChar

        ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "AOCQuestionSubmitted.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
  End If
End If
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/McCormTemplate.dwt.asp" codeOutsideHTMLIsLocked="false" -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Contact MAi</title>
<!-- InstanceEndEditable -->
<link href="CSS/McCorm.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
    background-color: #F9FAFC;
    background-image: url(Images/Background.jpg);
    background-repeat: repeat-x;
<!-- InstanceBeginEditable name="head" -->
<script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />

<div id="Wrapper">
  <div id="Logo">
    <div id="LogoText">
      <p class="h1">McCormack &amp; Associates, inc.</p>
      <p class="h3">Bankers Helping Bankers</h3>
  <a href="index.asp"><img src="Images/final gif 092010.gif" alt="MAi Logo" width="135" height="90" /></a></div>
  <!-- InstanceBeginEditable name="headerimg" --><img src="Images/bigstock_Planning_2738738.jpg" width="950" height="250" /><!-- InstanceEndEditable -->
  <div id="bodyArea">
    <div id="left">
      <ul id="MenuBar1" class="MenuBarVertical">
        <li><a href="index.asp">Home</a>        </li>
        <li><a href="Services.asp">Services</a></li>
        <li><a href="FeaturedServices.asp">Featured</a>        </li>
        <li><a href="Consultants Auditors.asp" class="MenuBarItemSubmenu">Meet MAi</a>
<li><a href="Consultants Auditors.asp">Consultants</a></li>
<li><a href="Staff.asp">Staff</a></li>
<li><a href="Careers.asp">Careers</a></li>
<li><a href="ClientNews.asp">Industry News</a></li>
        <li><a href="ClientNews.asp">Resources</a></li>
        <li><a href="aoc.asp">Auditor on Call</a></li>
<li><a href="https://www.bankonitusa.com/securedoc/" target="_blank">Client Access</a></li>
<li><a href="https://access.mccorm.com/laserfiche/">Examiner Access</a></li>
<li><a href="Contact Us.asp">Contact Us</a></li>
      <p><br />
<br />
<br />

    <div id="right">
      <div id="middle"><!-- InstanceBeginEditable name="MiddleRegion" -->
        <form action="<%=MM_editAction%>" method="POST" name="form1" id="form1" accept-charset="iso-8859-1">
          <div id="formdiv">
            <div id="Contact Form">
              <p class="center">&nbsp;</p>
              <p><span id="sprytextarea1"><span id="sprytextarea2">
                  <textarea name="Message" cols="40" rows="5" class="contactmessage" id="Message"></textarea>
                  <br />
                  <br />
                  Bank Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <input name="Bank Name" type="text" class="alignformfieldwider" id="Bank Name" />
                  <br />
                  <br />
                  First Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <input name="First Name" type="text" class="alignformfieldwider" id="First Name" />
                <span class="textareaRequiredMsg">A value is required.</span></span><span class="textareaRequiredMsg">A value is required.</span></span></p>
                <label>Last Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&thinsp;
                  <input name="Last Name" type="text" class="alignformfieldwider" id="Last Name" />
                <label>Phone Number&nbsp;&nbsp;&nbsp;&nbsp;&thinsp;
                  <input name="Phone Number" type="text" class="alignformfieldwider" id="Phone Number" />
              <p><span id="sprytextfield1"><span id="sprytextfield2">
                <label>Email Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&thinsp;
                  <input name="Email Address" type="text" class="alignformfieldwider" id="Email Address" />
                <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span><span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p>
                <label><br />
                  <input name="SUBMIT" type="submit" class="pcenter" id="SUBMIT" value="Submit" />
                <input type="reset" name="Reset" id="Reset" value="Reset" />
          <input type="hidden" name="MM_insert" value="form1" />
          <input type="hidden" name="hdwuploadfolder" id="hdwuploadfolder" value="Uploads" />
          <input type="hidden" name="hdwtablename" id="hdwtablename" value="Contact Us" />
          <input type="hidden" name="hdwok" id="hdwok" value="AOCQuestionSubmitted.asp" />
          <input type="hidden" name="hdwemail" id="hdwemail" value="info+mccorm.com" />
          <input type="hidden" name="hdwnook" id="hdwnook" value="AOC CONTACT Fail.asp" />
      <!-- InstanceEndEditable --></div>
      <div id="rightside"><!-- InstanceBeginEditable name="RightRegion" -->
        <p><img src="Images/address.gif" width="275" height="275" align="middle" /><br />
          <br />
        <script type="text/javascript">
var sprytextarea2 = new Spry.Widget.ValidationTextarea("sprytextarea2");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email");
      <!-- InstanceEndEditable --></div>
    <!--right close-->
  <div id="footer"></div>
  <!--body area close-->

</div><!--end of wrapper-->
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-19621495-1']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

<!-- InstanceEnd --></html>]

I've hit a brick wall trying to figure it out. I really appreciate your help

Edited by happygeek: fixed formatting

7 Years
Discussion Span
Last Post by ArtistScope

PHP and ASP are two distinctly different programming languages that will not run on the same web page at all.


Thank you- No wonder I'm stumped. Do you have or know where I can get example code of an ASP email notification using CDOSYS?



Set ObjSendMail = CreateObject("CDO.Message")   
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send using SMTP
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strMailServer
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = strHtmlFormat 
	ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60    
	ObjSendMail.To = strToEmail
	ObjSendMail.Subject = strSubject
	ObjSendMail.From = strFromEmail
   	ObjSendMail.TextBody = strMessage 
	Set ObjSendMail = Nothing

Edited by ArtistScope: n/a


Thank you so much- Do I post this code into the original asp document and if so where? As you can tell I'm a newbie and I really appreciate it!


Place it wherever (when) you want it send the email. Buy be sure to load the variables somewhere before it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.