Jump to content

CDO.Message


Recommended Posts

I have not been able to locate any instalment that deals with attachments not being transported. This is the code

CODE
Global $error = 0

$oMyError = ObjEvent("AutoIt.Error", "ErrFunc")

$objMessage = ObjCreate ("CDO.Message")

With $objMessage

.Subject = "Who am I"

.Sender = "anyone@anywhere.com"

.From = ""

.To = "someone@somewhere.com"

.TextBody = "test"

.AddAttachment = ("c:\temp\test.txt")

EndWith

With $objMessage.Configuration.Fields

.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.SERVER.com" ; <== SMTP SERVER

.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "anyone@anywhere.com" ; <== SMTP USERNAME

.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xyz" ; <== SMTP PASSWORD

.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

.Update

EndWith

$objMessage.Send

Func ErrFunc()

$error = 1

Endfunc

If $error = 1 Then

msgbox(0,"","Error Detected")

$error = 0

Else

msgbox(0,"","Error NOT Detected")

EndIf

The code when run reports an error. However the email is sent but the receipient does not receive the attachment. My guess is that the error is due to the attachment not being processed by the routine. Is there a solution to this issue?

Ant...

Link to comment
Share on other sites

Thanks for that its was very much appreciated.

Now it works perfectly.

I guess that sometimes we cannot see the woods for the trees.

I'd hate to tell you how long I have played with that one and not identified that the problem was the equals (=).

Boy do I feel sheepish.........

Ant..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...