Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDO's Email Sends to one address and not other.

Status
Not open for further replies.

winston1984

IS-IT--Management
Jun 4, 2004
17
0
0
GB
I have the code below, now if I sent the sub email to lewis@lharvey.com, it works fine, but sending to anything@ison-distribution.com it doesn't. Norton won't even scan it on the way out. The only difference in addresses is that the ison ones are forwarded and not email accounts, any ideas?

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()

On Error Resume Next

dim strRecord
dim strRecord1
dim strEmailBody
dim objFSO
dim objStream
dim objMail
dim objResults
dim objLanded
dim objMax
dim objReorder
dim objReQuan
dim objGroup

const OUTPUT_FILE = "e:\sqloutput\checks.txt"
const fsoForWriting = 2

set objFSO = CreateObject("Scripting.FileSystemObject")
set objResults = DTSGlobalVariables("gResults").Value
set objLanded = DTSGlobalVariables("landedCost").Value
set objMax = DTSGlobalVariables("MaxStock").Value
set objReorder = DTSGlobalVariables("ReorderLevel").Value
set objReQuan = DTSGlobalVariables("ReorderQuan").Value
set objGroup = DTSGlobalVariables("ProdGroup").Value

set objStream = objFSO.OpenTextFile(OUTPUT_FILE, fsoForWriting, true)

objStream.WriteLine("Errors In Pricing From System")
objStream.WriteBlankLines(1)
objStream.WriteLine("Trade Price Checks")
objStream.WriteBlankLines(1)
objStream.WriteLine("ProductID" & VBTab & VBTab & "Ison7" & VBTab & VBTab & "Stock")

objStream.WriteBlankLines(1)
'Loop through the records and output each one
'to a file.

while not objResults.EOF
strRecord = objResults.Fields(0).value & VBTab & VBTab &_
objResults.Fields(1).value & VBTab & VBTab &_
objResults.Fields(3).value

objStream.WriteLine(strRecord)
objResults.MoveNext
wend

objStream.WriteBlankLines(1)

objStream.WriteLine("Flag Check")
objStream.WriteBlankLines(1)
objStream.WriteLine("ProductID" & VBTab & VBTab & "Ison7" & VBTab & VBTab & "Stock")

objStream.WriteBlankLines(1)
'Loop through the records and output each one
'to a file.

while not objLanded.EOF
strRecord1 = objLanded.Fields(0).value & VBTab & VBTab &_
objLanded.Fields(1).value & VBTab & VBTab &_
objLanded.Fields(2).value

objStream.WriteLine(strRecord1)
objLanded.MoveNext
wend

objStream.WriteBlankLines(1)

objStream.WriteLine("Max Stock Check")
objStream.WriteBlankLines(1)
objStream.WriteLine("ProductID" & VBTab & VBTab & "Ison7" & VBTab & VBTab & "Stock")

objStream.WriteBlankLines(1)
'Loop through the records and output each one
'to a file.

while not objMax.EOF
strRecord1 = objMax.Fields(0).value & VBTab & VBTab &_
objMax.Fields(1).value & VBTab & VBTab &_
objMax.Fields(2).value

objStream.WriteLine(strRecord1)
objMax.MoveNext
wend

objStream.WriteBlankLines(1)

objStream.WriteLine("Reorder Level Check")
objStream.WriteBlankLines(1)
objStream.WriteLine("ProductID" & VBTab & VBTab & "Ison7" & VBTab & VBTab & "Stock")

objStream.WriteBlankLines(1)
'Loop through the records and output each one
'to a file.

while not objReorder.EOF
strRecord1 = objReorder.Fields(0).value & VBTab & VBTab &_
objReorder.Fields(1).value & VBTab & VBTab &_
objReorder.Fields(2).value

objStream.WriteLine(strRecord1)
objReorder.MoveNext
wend

objStream.WriteBlankLines(1)

objStream.WriteLine("Reorder Quantity Check")
objStream.WriteBlankLines(1)
objStream.WriteLine("ProductID" & VBTab & VBTab & "Ison7" & VBTab & VBTab & "Stock")

objStream.WriteBlankLines(1)
'Loop through the records and output each one
'to a file.

while not objReQuan.EOF
strRecord1 = objReQuan.Fields(0).value & VBTab & VBTab &_
objReQuan.Fields(1).value & VBTab & VBTab &_
objReQuan.Fields(2).value

objStream.WriteLine(strRecord1)
objReQuan.MoveNext
wend

objStream.WriteBlankLines(1)

objStream.WriteLine("Product Groupl Check")
objStream.WriteBlankLines(1)
objStream.WriteLine("ProductID" & VBTab & VBTab & "Ison7" & VBTab & VBTab & "Stock")

objStream.WriteBlankLines(1)
'Loop through the records and output each one
'to a file.

while not objGroup.EOF
strRecord1 = objGroup.Fields(0).value & VBTab & VBTab &_
objGroup.Fields(1).value & VBTab & VBTab &_
objGroup.Fields(2).value

objStream.WriteLine(strRecord1)
objGroup.MoveNext
wend


objStream.Close

if err.count = 0 then
Main = DTSTaskExecResult_Success
else
Main = DTSTaskExecResult_Failure
end if

SendMail()

End Function

Sub SendMail()
'Sending a text email with an attached file

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Price Change/Error Report for " & Date()
objMessage.Sender = "server@sbsidserver"
objMessage.To = "a.diss@ison-distribution.com"
objMessage.TextBody = "Please find attached the price changes or non matching values for " & Date() & "."
objMessage.AddAttachment "e:\sqloutput\checks.txt"
objMessage.Send


End Sub

 
The processing of delivery per recipient should take place on the mail server that holds the anything@ison-distribution.com alias. You may have relayer problems across a domain name.

I don't think this is a script error.

Nathan aka: zaz (zaznet)
zaz@zaz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top