Jump to content
Sign in to follow this  


Recommended Posts


I have not been able to locate any instalment that deals with attachments not being transported. This is the 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")


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




Func ErrFunc()

$error = 1


If $error = 1 Then

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

$error = 0


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


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?


Share this post

Link to post
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.........


Share this post

Link to post
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
Sign in to follow this