Wrox Programmer Forums
|
ASP CDO As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP CDO section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 20th, 2005, 12:30 PM
Registered User
 
Join Date: Jul 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Message.Send creates an error

Hello,

I have a Windows NT4 and IIS installed on the production server.
SMTP is running on the box. Something happens on the server that triggers the Message.Send CDO command to generate the following error:
"80090005 Bad Data. /rightsitedir/ftpASP/asp/SendMail.asp, line 120". Despite the error I can place in item into mail pickup directory and it gets sent.

The reboot solves the problem. However the following day it happens again. The problem seems to occur overnight and I suspect some sort of maintenance policy affects the way CDO interacts with IIS SMTP.

Please help and sorry for the long message. Thanks.

My code is below:

'Declare Variables

    Dim oMessage 'Message object
    Dim sFrom 'From Field
    Dim sTo 'To Field
    Dim sCC 'CC Field
    Dim sBCC 'BCC Field
    Dim sSubject 'Subject Field
    Dim sBody 'Body Field
    Dim sNewBody 'Special Body for mail re-direct

    'Fields Required for BLA routing
    Dim sApplType 'Type of Application IND/BLA
    Dim sApplSType 'Sub Type of Application Amendment/Original
    Dim sApplicant 'Company Name
    Dim sProduct 'Product
    Dim sIndication 'Indication
    Dim sRPM 'NOT KNOWN
    Dim sSTN 'Third level stn
    Dim sSTNId 'NOT KNOWN
    Dim sDCCLoginID 'DCC Number
    Dim sFDAReceivedDt 'Received date
    Dim sSubmitDt 'Submit Date
    Dim sParentSummary 'Parent summary
    Dim sEDRFolder 'NOT KNOWN
    Dim sRoadmap 'NOT KNOWN
    Dim sEDRMailTo 'Will hold the e-mail address of the CBER_SECURE mailbox

    'Retrieve message properties
    sFrom = Request("txt_from")
    sTo = Request("txt_to")
    sCC = Request("txt_cc")
    sBCC = Request("txt_bcc")
    sSubject = Request("txt_subject")
    sBody = Request("txt_body")
    'CCR 1564
    sEDRMailTo = Request("hdn_EDR_MAIL_TO")

    'Retrieve Specific Fields for BLA Routing
    sApplType = Request("txt_appl_type")
    sApplSType = Request("txt_appl_sub_type")
    sApplicant = Request("txt_applicant")
    sProduct = Request("txt_product")
    sIndication = Request("txt_indication")
    sRPM = Request("txt_rpm")
    sSTN = Request("txt_stn")
    sSTNId = Request("txt_stn_id")
    sDCCLoginID = Request("txt_dcc")
    sFDAReceivedDt = Request("txt_received_dt")
    sSubmitDt = Request("txt_submit_dt")
    sParentSummary = Request("txt_summary")
    sEDRFolder = Request("txt_edr_folder")
    sRoadmap = Request("txt_roadmap")

    'Create Message Object
    Set oMessage = CreateObject("CDONTS.NewMail")
    oMessage.From = sFrom
    'CCR 1564
    oMessage.To = sEDRMailTo
    oMessage.Subject = "* eBLA Routing *"
    oMessage.BodyFormat = 1

    'Populate message body with special properties
    'Those properties become special fields when message is resent
    sNewBody = "*To=" & sTo & vbCr
    sNewBody = sNewBody & "*Cc=" & sCc & vbCr
    sNewBody = sNewBody & "*Bcc=" & sBcc & vbCr
    sNewBody = sNewBody & "*Subject=" & sSubject & vbCr

    'Different fields and forms are used depending on appl type and sub type
    'Make sure stn is present
    If sApplType = "BLA" AND sApplSType = "A" AND Not sSTN = "" Then
        sNewBody = sNewBody & "*Type=IPM.Note.EBLA_RPM_NOTE" & vbCr
        sNewBody = sNewBody & "#DCCLoginID=" & sDCCLoginID & vbCr
        sNewBody = sNewBody & "#STNId=" & sSTNId & vbCr
        sNewBody = sNewBody & "#STN=" & sSTN & vbCr
        sNewBody = sNewBody & "#FDAReceivedDt=" & sFDAReceivedDt & vbCr
        sNewBody = sNewBody & "#SubmitDt=" & sSubmitDt & vbCr
        sNewBody = sNewBody & "#Applicant=" & sApplicant & vbCr
        sNewBody = sNewBody & "#Product=" & sProduct & vbCr
        sNewBody = sNewBody & "#ParentSummary=" & sParentSummary & vbCr
        sNewBody = sNewBody & "#Indication=" & sIndication & vbCr
        sNewBody = sNewBody & "#RPM=" & sRPM & vbCr
        sNewBody = sNewBody & "#EDRFolder=" & sEDRFolder & vbCr
        sNewBody = sNewBody & "#RoadMap=" & sRoadmap & vbCr
    Elseif sApplType = "BLA" AND sApplSType = "O" Then
        sNewBody = sNewBody & "*Type=IPM.Note" & vbCr
    Elseif sApplType = "IND" Then
        sNewBody = sNewBody & "*Type=IPM.Note.CBER SM Load Notification" & vbCr
    Else
        sNewBody = sNewBody & "*Type=IPM.Note" & vbCr
    End If

    'Finally add the actual message body
    sNewBody = sNewBody & "*Message=" & sBody

    'CCR 1518 -- Encode the "." with a character string
    sNewBody = Replace(sNewBody, ".", "#$*%!$#")
    oMessage.Body = sNewBody

    'Mail format need to be set to 0 i.e. mime formatting to prevent automatic line wrapping
    oMessage.MailFormat = 0

    'Send a message
    oMessage.Send

    'Destroy objects
    Set oMessage = Nothing

    Response.Write "<html>"
    Response.Write "<SCRIPT LANGUAGE=JavaScript>"
    Response.Write " "
    Response.Write " function CloseWindow() {"
    Response.Write " window.resizeTo(500,500); "
    Response.Write " setTimeout(""window.close()"",3000); "
    Response.Write " } "
    Response.Write "</SCRIPT> "
    Response.Write "<body BGCOLOR=#EEEEEE onload=""CloseWindow()"" >"

    'Error handling routine
    If Err.Number <> 0 Then
        Response.Write "<h4 align=center>Error Sending This E-Mail</h4>"
        Response.Write "<h4>" & Err.Number & " " & Err.Description & "</h4>"
    Else
        Response.Write " <BR>"
        Response.Write " <h4 align=center>This E-Mail Has Been Sent.</h4>"
    End If

    'Response.Write "<h2>Actual Mail To:" & sEDRMailTo & "</h2>"
    Response.Write "<pre> From: " & sFrom & "<br>"
    Response.Write " To: " & sTo & "<br>"
    Response.Write " CC: " & sCC & "<br>"
    Response.Write " BCC: " & sBCC & "<br>"
    Response.Write "Subject: " & sSubject & "<br>"
    Response.Write Request("txt_body") & "</pre>"

    Response.Write " <h4 align=center>Window will close itself in 3 seconds.</h4>"
    Response.Write "</body></html> "

End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to send attachment with text message ashuphp PHP How-To 1 October 29th, 2007 06:08 PM
Send Message to Email inbaa ASP.NET 1.0 and 1.1 Professional 2 August 28th, 2006 05:45 AM
send message to many recipients eda BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 May 29th, 2006 08:49 PM
Send message on Local net qazi_nomi Classic ASP Basics 3 October 26th, 2004 02:22 AM
How to send message to SMS !!!!! stevenThu Classic ASP Professional 4 August 26th, 2004 10:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.