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
|