ASP Email

Results 1 to 2 of 2

Thread: ASP Email

  1. #1
    Jason Guest

    Default ASP Email

    could someone please look at my code and tell me whats wrong. The data from the form makes it to the database 100% of the time. But i only recive the email about 50 % of the time. what is going on??<BR><BR>&#060;%<BR> Function ParseBody(strText)<BR> <BR> strText = Replace(strText, Chr(13), "<BR>")<BR> <BR> ParseBody = strText<BR> <BR> End Function<BR><BR> &#039;SET UP DATABASE CONNECTION<BR> Dim objConn<BR> Set objConn = Server.CreateObject("ADODB.Connection")<BR> objConn.Open "dsn=TO"<BR><BR> <BR> &#039;DECLARE RECORDSET FOR ADD<BR> Dim objRS<BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR> objRS.Open "TO", objConn, adOpenKeySet, adLockOptimistic, adCmdTable<BR><BR> objRS.AddNew<BR> objRS("STR_FROM_ORG") = Request.Form("FromORG")<BR> objRS("STR_To_ORG") = Request.Form("ToORG")<BR> objRS("STR_From_Working_Title") = Request.Form("FromWorkingTitle")<BR> objRS("STR_To_Working_Title") = Request.Form("ToWorkingTitle")<BR> objRS("STR_From_Classification") = Request.Form("FromClassification")<BR> objRS("STR_To_Classification") = Request.Form("ToClassification")<BR> objRS("STR_From_Employee_Name") = Request.Form("FromEmployeeName")<BR> objRS("STR_To_Employee_Name") = Request.Form("ToEmployeeName")<BR> objRS("STR_From_Class") = Request.Form("FromClass")<BR> objRS("STR_To_Class") = Request.Form("ToClass")<BR> objRS("STR_From_Fund") = Request.Form("FromFund")<BR> objRS("STR_To_Fund") = Request.Form("ToFund")<BR> objRS("STR_From_Code") = Request.Form("FromCode")<BR> objRS("STR_To_Code") = Request.Form("ToCode")<BR> objRS("STR_From_Full_or_Part") = Request.Form("FromFullorPart")<BR> objRS("STR_To_Full_or_Part") = Request.Form("ToFullorPart")<BR> objRS("STR_From_Position") = Request.Form("FromPosition")<BR> objRS("STR_To_Position") = Request.Form("ToPosition")<BR> objRS("STR_From_Add_Position") = Request.Form("FromAddPosition")<BR> objRS("STR_To_Add_Position") = Request.Form("ToAddPosition")<BR> objRS("STR_SUBMITTED_BY") = Request.Form("SubmittedBy")<BR> objRS("DTM_Date_of_TO_Used") = Request.Form("DateofToUsed")<BR> objRS("STR_Approved_By") = Request.Form("ApprovedBy")<BR> objRS("STR_Assistant_Director") = Request.Form("AssistantDirector")<BR> objRS("DTM_Date_Submitted_TO_HR") = Request.Form("DateSubmittedtoHR")<BR> objRS("STR_Email_Address") = Request.Form("EmailAddress")<BR> &#039;objRS("DTM_Time_Stamp") = Request.Form("TimeStamp")<BR> objRS.Update<BR> <BR> Dim strID<BR> strID=objRS("ID")<BR> <BR> &#039;Close the connection<BR> objRS.Close<BR> Set objRS = Nothing<BR> objConn.Close<BR> Set objConn = Nothing <BR> &#039;******************************************** ********************************<BR> &#039;Email<BR> &#039;******************************************** ********************************<BR> Dim myCDONTSMail<BR> Dim strTo<BR> Dim strFrom<BR> Dim strSubject<BR> Dim strBody<BR> Dim strsubby <BR> <BR>strsubby= Request.Form("SubmittedBy")<BR>strTo= Request.Form("EmailAddress")<BR>strFrom= Request.Form("submittedBy")<BR>strSubject = "Table of Organization Change Form"<BR>strBody = strsubby &", has submitted a Table of Organization Form:" & vbcrlf & "ID #: = " & strID & vbcrlf & "Please go to HTTP://jfsstage/JFSSTAGE/TO/searchid.asp and enter the ID Number above for this Request." <BR><BR> <BR> &#039;Create a new mail message object<BR>Set myCDONTSMail = CreateObject("CDONTS.NewMail")<BR><BR>&#039;Sent the new mail message object by passing the parameters<BR>&#039;defined above<BR>myCDONTSMail.Send strFrom,strTo,strSubject,strBody<BR>&#039;Set the new mail message object to Nothing to free resources<BR>Set myCDONTSMail = Nothing<BR>%&#062;

  2. #2
    Alex Walgreen Guest

    Default RE: ASP Email

    Try to set the properties from myCDONTSMail before sending, also use &#039;Server.CreateObject&#039; instead of only &#039;CreateObject&#039; So, something like this:<BR><BR>Set myCDONTSMail = Server.CreateObject("CDONTS.NewMail")<BR>myCDONTSM ail.From = strFrom<BR>myCDONTSMail.To = strTo<BR>myCDONTSMail.Subject = strSubject<BR><BR>etc. etc.<BR><BR>How I described above, I send about 4 e-mails at once without recreating the object. Works perfect!!<BR><BR>Please give me feedback to let me know if it worked at

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts