Avatar of IIS6_cursed
IIS6_cursed
 asked on

different email results from the same code - one recipient only gets a "0" in the email

This one is a real challenge.  The code is listed below.  

The problem:  When someone submits a request using this form, two emails are generated.  One to my work email account, and the other to a general mailbox for the department that fills the request.  The email I receive looks fine and works without problem, but the email the department gets simply has a "0" in it.  That's all -  no information, no data, just a 0.  I'm using the same process to generate both emails, so this doesn't make any sense.

Any ideas?  Is this a coding issue or is something wrong with the other mailbox?  This form worked fine for them when we were on an IIS5 server - but since we migrated to IIS6, it doesn't want to work.  Please advise.  Thanks!

<%
' Setup E-mail and send to Network Management...
Set myMail = Server.CreateObject("CDO.Message")

myMail.From = objUpload.Form.Item(6)
myMail.To = "m6_nmanalysis@healthlink.com"
myMail.To = "bptouch@healthlink.com"

myMail.Subject = "GR-" & currentNetManGRNum & " / " & objUpload.Form.Item(2)

If objUpload.Files.Count > 0 Then
      For lngLoop = 0 to objUpload.Files.Count - 1
            myMail.AddAttachment Server.MapPath("../Data/" & objUpload.Files.Item(lngLoop).FileName)
      Next
End If

myMail.TextBody = 1
myMail.HtmlBody = 0

myBodyText = "-----------------------"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "REQUESTOR'S INFORMATION"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-----------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Requested By:"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "   Name: " & objUpload.Form.Item(4) & " " &  objUpload.Form.Item(5)
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "   E-Mail: " & objUpload.Form.Item(6)
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "   Department: " & objUpload.Form.Item(8)
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "   Phone Number: " & objUpload.Form.Item(7)
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "---------------------"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "DATE REQUESTED/NEEDED"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "---------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Date Requested: " & FormatDateTime(Date(),1)
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Date Needed: " & objUpload.Form.Item(1)
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "----------------------------"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "ANALYST GENERAL REQUEST INFO"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "----------------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Analyst General Request Form Number: GR-" & currentNetManGRNum
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Short Description: " & objUpload.Form.Item(2)
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Description: " & objUpload.Form.Item(3)
myBodyText = myBodyText & vbCrLf & vbCrLf

If objUpload.Files.Count > 0 Then
      myBodyText = myBodyText & "Attached File(s) or Document(s): The requester attached " & objUpload.Files.Count & " file(s) to this form."
Else
      myBodyText = myBodyText & "Attached File(s) or Document(s): The requester did not attach any files to this form."
End If

myMail.TextBody = myBodyText

myMail.Send

Set myMail = Nothing
%>

ASP

Avatar of undefined
Last Comment
IIS6_cursed

8/22/2022 - Mon
Carl Tawn

It sounds like it is sending the message as HTML rather than Text, I guess it is 0 because of the line:

    myMail.HtmlBody = 0

Although I'm not sure why you have the two lines:

    myMail.TextBody = 1
    myMail.HtmlBody = 0

Try removing those two lines and see what happens.
IIS6_cursed

ASKER
OK, I tried commenting out the HTMLBody line, and this time they didn't even get an email.  Any ideas?
ASKER CERTIFIED SOLUTION
Carl Tawn

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ullfindsmit

do myMail.To = "John <john@some_domain.com>; Gary <gary@some_domain.com>"
Your help has saved me hundreds of hours of internet surfing.
fblack61
ullfindsmit

IIS6_cursed

ASKER
That did it, Carl.  Thanks a world for your help!