Link to home
Start Free TrialLog in
Avatar of team2005
team2005

asked on

Error message vb.script CDO

Hi!

Include the source for sending a email with attachment...
Working just fine on my computer.
I am using windows XP Pro.

Tryed the same code on my client PC.
And they are using Windows XP Pro olso...

But gat this error number:
80040220

Is there somthing missing in the source ?


' VB SCRIPT - AutosaveAndSend.vbs
' Lagrer vedlegg fra email til mappe VPIM (Navn lagret fil = N.txt
' Sender email til: production@edi.volvo.com med attatchment "CSV.XLC"
'
' NB! Outlock MÅ vere installert, for at skriptet skal fungere.
'
     sendemail "test@online.no","R3IN02T120001 40779","tor-er-b@online.no"
 
Sub sendemail(fraemail,subjekt,emailtil)
Dim objMessage
 
Set oFSO = CreateObject("Scripting.FileSystemObject")  ' Opretter filobjektet
Set objMessage = CreateObject("CDO.Message")
 
If oFSO.FileExists("C:\VPIM\F.txt") Then
'Sender email hvis CSV-filen er laget
    objMessage.Subject = subjekt
    objMessage.From = fraemail
    objMessage.To = emailtil
    objMessage.AddAttachment "c:\VPIM\N.txt"
    objMessage.Send  
End If

Open in new window

Avatar of sirbounty
sirbounty
Flag of United States of America image

Is the client behind another domain/isp?
You may have to add cdo configuration to setup the smtp address...
Hi, team2005.

What's the text of the error message?
Avatar of team2005
team2005

ASKER

Hi!

Okey, how to setup config file ?

Can't give you the text.... Dident write it down.
But i know that the error was coming from
objMessage.Send



Well, it would depend on the environment - did you send it successfully from your provider and it failed from another?
Could be a lot of reasons...since I still don't know, here's an example of a cdo message with configuration fields added/updated:
See http://www.paulsadowski.com/WSH/cdo.htm for more detail.


Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "me@my.com"
objMessage.To = "test@paulsadowski.com"
objMessage.TextBody = "This is some sample message text."

'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.myserver.com"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send
Hi!

Okey, i wil try this source on my client PC.
And come back to you, how it went...

Thanks for help...

Tor
Hi again!

Have testet your script sirbounty, but still gut problems

Maby some dll-file or somthing is missing ?


What problems/errors do you see?
ASKER CERTIFIED SOLUTION
Avatar of team2005
team2005

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial